KamoCRM

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

FixDaemonService
Shipped
20 ஆகஸ்ட், 2026 அன்று 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?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing