jonhoo / faktory-rs

Rust bindings for Faktory clients and workers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shorten heartbeat window to enable faster reaction times

jonhoo opened this issue · comments

Currently, the heartbeat thread sends a heartbeat every 5 seconds, as suggested by the Faktory documentation. However, the heartbeat handling code also performs additional operations, such as watching for the worker thread terminating. This means that there will be a ~2.5s delay between changes to the worker state and run returning, which is unfortunate.

The fix to this is to have the heartbeat thread sleep for shorter amounts of time, but only write once 5s has elapsed.