From aa970d2dfe90f2bf8f65f8dad2ff6e8f2c98cfc5 Mon Sep 17 00:00:00 2001 From: Paul Fletcher-Hill <1607180+pfletcherhill@users.noreply.github.com> Date: Wed, 22 Mar 2023 23:13:44 -0400 Subject: [PATCH] fix: prune in serial (#730) * changeset version * fix pruning error logging * Revert "changeset version" This reverts commit 144fa7071a7e17bfcc2768c8f426af239f816944. * prune bug investigation --- apps/hubble/src/storage/jobs/pruneMessagesJob.ts | 4 +++- apps/hubble/src/storage/stores/storeEventHandler.ts | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/hubble/src/storage/jobs/pruneMessagesJob.ts b/apps/hubble/src/storage/jobs/pruneMessagesJob.ts index 8a23d50c..0f2d6675 100644 --- a/apps/hubble/src/storage/jobs/pruneMessagesJob.ts +++ b/apps/hubble/src/storage/jobs/pruneMessagesJob.ts @@ -51,7 +51,9 @@ export class PruneMessagesJobScheduler { pageToken = nextPageToken; } - await Promise.all(fids.map((fid) => this._engine.pruneMessages(fid))); + for (const fid of fids) { + await this._engine.pruneMessages(fid); + } } while (!finished); log.info({}, 'finished prune messages job'); diff --git a/apps/hubble/src/storage/stores/storeEventHandler.ts b/apps/hubble/src/storage/stores/storeEventHandler.ts index b5b22f47..0ef411a8 100644 --- a/apps/hubble/src/storage/stores/storeEventHandler.ts +++ b/apps/hubble/src/storage/stores/storeEventHandler.ts @@ -170,7 +170,7 @@ class StoreEventHandler extends TypedEmitter { async commitTransaction(txn: Transaction, eventArgs: HubEventArgs[]): HubAsyncResult { return this._lock - .acquire('default', async () => { + .acquire('commit', async () => { const events: HubEvent[] = []; for (const args of eventArgs) { @@ -187,10 +187,8 @@ class StoreEventHandler extends TypedEmitter { await this._db.commit(txn); for (const event of events) { - if (this._storageCache) { - this._storageCache.processEvent(event); - } - this.broadcastEvent(event); + void this._storageCache.processEvent(event); + void this.broadcastEvent(event); } return ok(events.map((event) => event.id));