You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rest): make async import-job cancellation actually stop the worker (#2824) (#3069)
On a synchronous storage driver (better-sqlite3 / wasm fallback) every await
in the import row loop resolves as a microtask, so a 50k-row import starved
the Node event loop for minutes: the cancel route's HTTP handler (and every
progress poll) never ran, the in-memory flag `shouldCancel` polls was never
set, and the job finished `succeeded` with all rows written despite the
user's cancel.
- runImport now yields one macrotask at every progress boundary so pending
I/O (cancel requests, progress polls) is serviced mid-import.
- The worker's shouldCancel also reads the durable job row as a fallback,
covering cancels accepted by another process or after a restart.
- A late cancel wins the terminal state: the worker's final patch no longer
overwrites the durable 'cancelled' with 'succeeded', and a job cancelled
while still pending doesn't start at all.
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments