From 87236c940f9bd7f97bc641d07fdb935514f33244 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 26 Mar 2025 12:43:29 -0700 Subject: [PATCH] Fix scheduling of paging queries --- ts/sql/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ts/sql/main.ts b/ts/sql/main.ts index 49dc6fb59..b34802e25 100644 --- a/ts/sql/main.ts +++ b/ts/sql/main.ts @@ -254,10 +254,11 @@ export class MainSQL { }>; // pageMessages runs over several queries and needs to have access to - // the same temporary table. + // the same temporary table, it also creates temporary insert/update + // triggers so it has to run on the same connection that updates the tables const isPaging = PAGING_QUERIES.has(method); - const entry = isPaging ? this.#pool.at(-1) : this.#getWorker(); + const entry = isPaging ? this.#pool[0] : this.#getWorker(); strictAssert(entry != null, 'Must have a pool entry'); const { result, duration } = await this.#send(entry, {