Skip to main content

reaper

Function reaper 

Source
pub async fn reaper(
    conn: &DatabaseConnection,
    queue: &str,
    visibility_timeout: Duration,
) -> Result<(), Error>
Expand description

Re-queue claimed rows that have been held longer than visibility_timeout.

attempts is the number of attempts already completed. A row is requeued (for one more attempt) only while attempts + 1 < max_retries; once the next attempt would be the last allowed (attempts + 1 >= max_retries) the row is parked as failed. This matches the worker’s handler-failure boundary (handle_failure: park when attempts + 1 >= max_retries) so a job gets the same total attempt count whether it fails via handler error or via visibility timeout (WR-01, T-185-04).