Skip to content

Move processing heartbeats off the reactor - #8

Open
crmne wants to merge 1 commit into
socketry:mainfrom
crmne:fix-threaded-heartbeats
Open

Move processing heartbeats off the reactor#8
crmne wants to merge 1 commit into
socketry:mainfrom
crmne:fix-threaded-heartbeats

Conversation

@crmne

@crmne crmne commented Mar 29, 2026

Copy link
Copy Markdown

Closes #7.

This moves the processing heartbeat / abandoned-job recovery loop off the job reactor and onto a dedicated Ruby thread with its own Redis client.

The important behavior change is that a worker can now continue to own an in-flight job even if the job body temporarily blocks the reactor. Throughput may degrade under blocking workloads, but correctness should not: a still-running job should not look abandoned and be re-executed.

What changed:

  • ProcessingList#start now runs the heartbeat/requeue loop in a dedicated thread.
  • The thread uses its own Async::Redis::Client, so the liveness path no longer depends on the job reactor yielding.
  • Server exposes configurable heartbeat_interval and heartbeat_factor options and shuts the heartbeat thread down cleanly.
  • Tests were updated to cover the threaded heartbeat path, and the existing status-string assertion was made less timing-sensitive.

Validation:

  • bundle exec sus

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.

Move processing heartbeats off the reactor and make timing configurable

1 participant