Under the hood
A Postgres query now runs with an explicit 2-second statement timeout inside a wrapped transaction
What
A rewritten internal database query helper now wraps its work in an explicit transaction: BEGIN, then SET LOCAL statement_timeout = '2s', then COMMIT, run with Promise.allSettled and an abort check before it even starts. This replaces an older version that made a single call without this wrapping.
Why
This puts a hard 2-second cap on how long this particular database query can run, preventing it from hanging indefinitely and holding up whatever depends on its result.