Persist each payload's outcome as it happens, not in one batch

FixDaemonService
Shipped
August 20, 2026 at 9:54 PM UTC
Author
Kamo
Commit
29fdf8a

processEndpointPayloads looped over the batch mutating statuses in memory and saved them all at the end. createLead commits per lead, so any failure of that final save — or a crash mid-batch — left committed leads whose payloads were still RECEIVED. The next run (the cron is every minute) re-imported them, and because this path has no vendorLeadID dedup, every one became a second lead. A 789-row run produced 1389 leads that way: 600 businesses duplicated. Saving each payload's outcome immediately after its lead commits narrows the window from the whole batch to a single row. Not fixed here, and worth knowing: this path still has no duplicate detection at all — totalDuplicates is hard-wired to 0, unlike the import wizard. A vendor re-posting the same vendorLeadID gets another lead.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing