KamoCRM

Harden closed-loan trainer — concurrency, idempotency, limits

FeatureSecurityService
Shipped
15 ஜூலை, 2026 அன்று 3:26 AM UTC
Author
Kamo
Commit
807a235

- Concurrency: in-process activeOrgs guard + the DB claim() so this instance never double-walks an org and two replicas can't overlap; a run whose heartbeat is >10min stale is reclaimable (process died mid-walk). - Idempotency: skip loans already marked closedLoanTrainedAt, and mark a loan only after a real closed-loan training pass (not-yet-closed loans stay unmarked so later passes catch them once they close). - Memory safety: skip documents over 30MB — downloadDocument buffers the whole file and SecurityService is memory-tight. - Signed-URL TTL for training docs is now configurable and defaults to 15min so a slow 15-page vision read can't outrun a 5-min token.

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