Skip to content

[Deferred] Dead task deletion and retry - #411

Open
alex-rogachev wants to merge 3 commits into
rage-rb:mainfrom
alex-rogachev:deferred-delete-and-retry
Open

alex-rogachev wants to merge 3 commits into
rage-rb:mainfrom
alex-rogachev:deferred-delete-and-retry

Conversation

@alex-rogachev

@alex-rogachev alex-rogachev commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Add deletion and manual retry for tasks in the deferred dead-letter queue.

  • DeadTasks#delete(id_or_ids) deletes one or multiple tasks and returns the number of distinct IDs removed.
  • DeadTask#delete deletes an individual task and returns whether it was removed.
  • DeadTask#retry enqueues the task with its original arguments, a new ID, and reset attempts, then removes the dead record. It uses the normal enqueue middleware and flushes pending writes when supported.
  • Tasks retried outside a running server are persisted for execution after restart, with a warning.

Retry follows at-least-once semantics: concurrent retries or failures after enqueue can produce duplicates, so tasks and enqueue middleware must be safe to repeat. Middleware that suppresses enqueue still allows the dead record to be removed.

Gotchas:

  • Queue#schedule does nothing when Iodine is not running. A task enqueued from the console or a Rake task is stored and runs after the next server start. retry prints a warning in this case.
  • The Disk backend gets an optional flush_tasks method. retry calls it to write the new task to disk at once, without waiting for the fsync timer.
  • The Disk backend now fsyncs the storage directory after it creates a new WAL file, so the file entry survives a crash.

@alex-rogachev
alex-rogachev force-pushed the deferred-delete-and-retry branch 3 times, most recently from d42683e to 0b3baa7 Compare October 17, 2026 19:15
@serhii-sadovskyi
serhii-sadovskyi force-pushed the deferred-delete-and-retry branch 2 times, most recently from 54dfc4c to 11c2427 Compare October 20, 2026 18:14
@alex-rogachev
alex-rogachev force-pushed the deferred-delete-and-retry branch 2 times, most recently from 7b13e35 to 6de380a Compare October 30, 2026 11:24
@serhii-sadovskyi
serhii-sadovskyi force-pushed the deferred-delete-and-retry branch 2 times, most recently from 4e3a4ba to f766cb8 Compare November 3, 2026 22:41
alex-rogachev and others added 2 commits November 4, 2026 15:20
Co-authored-by: Serhii Sadovskyi <sadovsky.sb@gmail.com>
Co-authored-by: Serhii Sadovskyi <sadovsky.sb@gmail.com>
@alex-rogachev
alex-rogachev force-pushed the deferred-delete-and-retry branch 2 times, most recently from a01decd to 14dd219 Compare November 4, 2026 13:50
Co-authored-by: Serhii Sadovskyi <sadovsky.sb@gmail.com>
@alex-rogachev
alex-rogachev force-pushed the deferred-delete-and-retry branch from 14dd219 to b700b1b Compare November 4, 2026 13:52
@alex-rogachev
alex-rogachev marked this pull request as ready for review November 5, 2026 15:01

This branch has not been deployed

No deployments
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.

1 participant