From edf56d77dfd6808440ec47358551bd76fde36808 Mon Sep 17 00:00:00 2001 From: David Whittington Date: Tue, 24 Sep 2024 13:36:52 -0500 Subject: [PATCH] chore: return promise from cleanupWal We want to return a promise so callers can await on it if desired. --- src/database/standalone-sqlite.ts | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/database/standalone-sqlite.ts b/src/database/standalone-sqlite.ts index 054fd432..91df613e 100644 --- a/src/database/standalone-sqlite.ts +++ b/src/database/standalone-sqlite.ts @@ -2973,25 +2973,27 @@ export class StandaloneSqliteDatabase } async cleanupWal(dbName: WorkerPoolName): Promise { - this.queueWrite(dbName, 'cleanupWal', [dbName]).then((walCheckpoint) => { - this.log.info('WAL checkpoint', { - dbName, - walCheckpoint, - }); + return this.queueWrite(dbName, 'cleanupWal', [dbName]).then( + (walCheckpoint) => { + this.log.info('WAL checkpoint', { + dbName, + walCheckpoint, + }); - metrics.sqliteWalCheckpointPages.set( - { db: dbName, type: 'busy' }, - walCheckpoint.busy, - ); - metrics.sqliteWalCheckpointPages.set( - { db: dbName, type: 'log' }, - walCheckpoint.log, - ); - metrics.sqliteWalCheckpointPages.set( - { db: dbName, type: 'checkpointed' }, - walCheckpoint.checkpointed, - ); - }); + metrics.sqliteWalCheckpointPages.set( + { db: dbName, type: 'busy' }, + walCheckpoint.busy, + ); + metrics.sqliteWalCheckpointPages.set( + { db: dbName, type: 'log' }, + walCheckpoint.log, + ); + metrics.sqliteWalCheckpointPages.set( + { db: dbName, type: 'checkpointed' }, + walCheckpoint.checkpointed, + ); + }, + ); } }