Skip to content

Commit 5889a7e

Browse files
authored
bin/background-worker: Increase database statement timeout to one hour (#11187)
Turns out unifying the database connection pool initialization had some unintended side effects for jobs in the background worker that use long-running database queries (e.g. `SELECT refresh_recent_crate_downloads()`). This commit fixes the issue by explicitly overriding the timeout to be one hour instead of the default 30 sec.
1 parent e38e064 commit 5889a7e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bin/background-worker.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ fn main() -> anyhow::Result<()> {
4646
// Override the pool size to 10 for the background worker
4747
config.db.primary.pool_size = 10;
4848

49+
// We run some long-running queries in the background worker, so we need to
50+
// increase the statement timeout a bit…
51+
config.db.primary.statement_timeout = Duration::from_secs(60 * 60);
52+
4953
let runtime = tokio::runtime::Builder::new_multi_thread()
5054
.enable_all()
5155
.build()

0 commit comments

Comments
 (0)