Skip to content

fix: make cancel operation durable — prevent feeders from overwriting CANCELLED status#43

Open
ChefControl wants to merge 1 commit into
masterfrom
issue-20
Open

fix: make cancel operation durable — prevent feeders from overwriting CANCELLED status#43
ChefControl wants to merge 1 commit into
masterfrom
issue-20

Conversation

@ChefControl
Copy link
Copy Markdown
Collaborator

Summary

  • Add WHERE n.job_status <> 'CANCELLED' guard to update_job_status so feeders can no longer overwrite CANCELLED back to COMPLETED
  • Re-check is_cancelled() right before batch_create_children() to prevent new PENDING children from being created after cancellation
  • Together these close the race window where a cancel fires mid-processing

Test plan

  • Start a deep crawl (e.g., https://wikipedia.org at depth 5)
  • Wait until feeders are actively processing
  • Cancel via DELETE /api/v1/crawls/:id
  • Verify crawl stops within seconds and no new children are created
  • Verify cancelled count reflects the cancelled URLs

Closes #20

🤖 Generated with Claude Code

Feeders that were mid-processing would overwrite CANCELLED status back
to COMPLETED and continue creating new PENDING children, effectively
undoing the cancel operation. This fixes the race in two ways:

1. Add WHERE n.job_status <> 'CANCELLED' guard to update_job_status so
   the Cypher SET is a no-op when the cancel operation already fired.
2. Re-check is_cancelled() right before batch_create_children() to
   prevent new PENDING children from being created after cancellation.

Closes #20

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: cancel operation is not durable — feeders overwrite CANCELLED status

1 participant