• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Freegle / Iznik / 23765

28 Jun 2026 05:20AM UTC coverage: 71.404% (+0.005%) from 71.399%
23765

push

circleci

invalid-email-address
feat(whatjobs): --refresh-geocode flag to bypass the jobs-table geocode cache

One-time retro-correction for tuples mis-cached by the old inverted-extent bug
(2bda6bae6). The jobs-table geocode cache (SELECT geom FROM jobs WHERE
city/state/country) otherwise perpetuates a wrong cached point even after the
extent fix. With --refresh-geocode, geocodeCityState skips that cache so every
tuple re-resolves from postcode/Photon fresh; the per-run in-memory cache still
dedupes (each tuple geocoded once). Normal hourly runs keep the cache (flag off).

Sample (200 random tuples, fresh): 0% geocode failure in 12.8s — Photon healthy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aXkxBPEiPSJBaRMjz7opk

11302 of 15029 branches covered (75.2%)

Branch coverage included in aggregate %.

9 of 14 new or added lines in 2 files covered. (64.29%)

51 existing lines in 1 file now uncovered.

123998 of 174455 relevant lines covered (71.08%)

37.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.21
/iznik-batch/app/Console/Commands/Integrations/SyncWhatJobsCommand.php
1
<?php
2

3
namespace App\Console\Commands\Integrations;
4

5
use App\Services\WhatJobsService;
6
use Illuminate\Console\Command;
7
use Illuminate\Support\Facades\Cache;
8
use Illuminate\Support\Facades\Log;
9

10
class SyncWhatJobsCommand extends Command
11
{
12
    protected $signature = 'integrations:sync-whatjobs
13
                            {--dry-run : Parse feeds and count jobs without writing to database}
14
                            {--refresh-geocode : Ignore the jobs-table geocode cache so every tuple re-geocodes fresh (one-time, to retro-correct mis-cached locations)}';
15

16
    protected $description = 'Sync WhatJobs job listings from XML feeds into the jobs table';
17

18
    public function handle(WhatJobsService $service): int
2✔
19
    {
20
        $dryRun = (bool) $this->option('dry-run');
2✔
21
        $service->forceRegeocode = (bool) $this->option('refresh-geocode');
2✔
22
        if ($service->forceRegeocode) {
2✔
NEW
23
            $this->info('--refresh-geocode: bypassing jobs-table geocode cache (one-time full re-geocode).');
×
24
        }
25

26
        // The WhatJobs XML feed currently parses ~180k jobs into memory
27
        // before insertJobs() flushes them in chunks (parseFeed builds the
28
        // full $jobs[] array and returns it). At PHP's default 512M, this
29
        // tips into a FatalError as soon as the second (clickcast) feed is
30
        // merged in. Raise the ceiling here so the run completes; the
31
        // longer-term fix is to convert parseFeed to a generator and stream
32
        // straight into insertJobs (TODO tracked in the service).
33
        ini_set('memory_limit', '1536M');
2✔
34

35
        // TTL matches the every-3-hours schedule (routes/console.php) plus
36
        // a comfortable margin: a cold-cache run that hits Photon for every
37
        // distinct city tuple can run for hours, far longer than the prior
38
        // 1h TTL.
39
        $lock = Cache::lock('sync-whatjobs', 4 * 3600);
2✔
40
        if (!$lock->get()) {
2✔
41
            $this->warn('Another integrations:sync-whatjobs is already running, skipping.');
×
42
            return self::SUCCESS;
×
43
        }
44

45
        try {
46
            if ($dryRun) {
2✔
47
                $this->info('[DRY RUN] Parsing WhatJobs feeds — no database changes will be made.');
1✔
48
            }
49

50
            Log::info('WhatJobs sync starting', ['dry_run' => $dryRun]);
2✔
51

52
            $result = $service->sync($dryRun);
2✔
53

54
            $prefix = $dryRun ? '[DRY RUN] Would insert' : 'Inserted';
2✔
55
            $this->info("$prefix {$result['inserted']} of {$result['total']} parsed jobs.");
2✔
56

57
            Log::info('WhatJobs sync command complete', $result);
2✔
58
        } finally {
59
            $lock->release();
2✔
60
        }
61

62
        return self::SUCCESS;
2✔
63
    }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc