anyone know off the top of their head what the best way to timeout a hyperdrive query using [postgre

anyone know off the top of their head what the best way to timeout a hyperdrive query using postgres.js?

we setup the client with these opts
{ connect_timeout: 1, max: 5 }
and also have some
setTimeout(
helpers wrapping the whole function issuing the query -- but still see some successful queries record latencies of multiple minutes sometimes

my understanding is that the wall clock in cf workers will only advance when there is external io performed, so setTimeout will often but not always enforce the timeout? (our metrics confirm this, but just making sure i understand why)

maybe just need to add a max_lifetime or idle_timeout to the connection options instead?

(pics are in US-mountain tz, with the cf dashboard showing avg query latency spiking around the same time as we were seeing internal metrics for max latencies higher than all the timeouts we have set in code)
image.png
image.png
Was this page helpful?