This repository was archived by the owner on Sep 11, 2026. It is now read-only.
Repository navigation
General-purpose timer API beyond idle timeout #232
Closed
SeanTAllen
started this conversation in
Research
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The idle timeout API is great for detecting dead connections, but it's really two things bundled together: an ASIO timer and a policy of resetting that timer on I/O activity. The postgres driver needs timers where the reset policy doesn't apply, and I suspect other lori consumers will too.
The concrete case: query timeouts. When a query starts, I want to set a timer. If the timer fires before the query finishes, I send a CancelRequest and notify the caller. The idle timeout can't do this because it resets every time the server sends data back. A query that's streaming rows for 30 seconds would never trigger the idle timeout, but it absolutely should trigger a 10-second query timeout.
The alternative is reaching around lori to raw ASIO timer events or pulling in the
Timersactor, but both of those have problems. Raw ASIO means depending on internals that could change.Timershas the scheduler livelock issue that the idle timeout was specifically designed to avoid by using per-connection ASIO events.Lori already has the infrastructure for this. The idle timeout uses
PonyAsio.create_timer_eventandPonyAsio.set_timerunder the hood. A general-purpose timer API would expose that same mechanism without the I/O-reset behavior, giving consumers a building block they can attach whatever policy they want to.I don't have a specific API proposal yet. Wanted to get the idea out there first and see if there's interest before working through the details.
All reactions