From c619a7b6fd7639e5ad9fd2d7d97b17a98ff3fa0b Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:06:32 -0700 Subject: [PATCH] Fix paging queries in the worker system --- ts/sql/main.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ts/sql/main.ts b/ts/sql/main.ts index 7cc07477b..85bfa579e 100644 --- a/ts/sql/main.ts +++ b/ts/sql/main.ts @@ -19,6 +19,13 @@ const MIN_TRACE_DURATION = 40; const WORKER_COUNT = 4; +const PAGING_QUERIES = new Set([ + 'pageMessages', + 'finishPageMessages', + 'getKnownMessageAttachments', + 'finishGetKnownMessageAttachments', +]); + export type InitializeOptions = Readonly<{ appVersion: string; configDir: string; @@ -216,7 +223,7 @@ export class MainSQL { // pageMessages runs over several queries and needs to have access to // the same temporary table. - const isPaging = method === 'pageMessages'; + const isPaging = PAGING_QUERIES.has(method); const entry = isPaging ? this.pool.at(-1) : this.getWorker(); strictAssert(entry != null, 'Must have a pool entry');