Skip to content

Commit

Permalink
agent: regularly poll all handlers, just in case we miss a notification
Browse files Browse the repository at this point in the history
The postgres channel/notify mechnanism doesn't seem 100% reliable. We used to
have a regular polling of handlers in order to guard against a missed
notification. That polling was removed as part of the `handlers::serve` a
couple commits ago. This re-introduces the polling to the new implementation.
  • Loading branch information
psFried committed Feb 20, 2024
1 parent a34a74c commit 7a29fb3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/agent/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ where
tracing::debug!(%table_name, "got notification for handler table");
handler.status = Status::PollInteractive;
}
_ = tokio::time::sleep(std::time::Duration::from_secs(60)) => {
tracing::debug!("polling all handlers, just in case we missed a notification");
for handler in handlers_by_table.values_mut() {
// No need to go through both interactive and background, since this is "extra"
// and handlers should still dequeue interactive jobs even when `allow_background = true`.
handler.status = Status::PollBackground;
}
}
}
}
}
Expand Down

0 comments on commit 7a29fb3

Please sign in to comment.