From aea8080d5510483973ccec404b221d58c3018ba7 Mon Sep 17 00:00:00 2001 From: Andy Kuny Date: Thu, 4 Apr 2024 09:49:16 -0400 Subject: [PATCH] Break Snapshot class method calls out of Promise.all --- libs/snapshot/src/snapshot.service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/snapshot/src/snapshot.service.ts b/libs/snapshot/src/snapshot.service.ts index 22670b8b..8b043c52 100644 --- a/libs/snapshot/src/snapshot.service.ts +++ b/libs/snapshot/src/snapshot.service.ts @@ -48,7 +48,7 @@ export class SnapshotService { `Total number of live websites retrieved for snapshot: ${liveWebsites.length}`, ); - const liveSnapshot = new Snapshot( + let liveSnapshot = new Snapshot( this.storageService, [new JsonSerializer(columns), new CsvSerializer(columns)], liveWebsites, @@ -56,9 +56,11 @@ export class SnapshotService { this.fileNameLive, ); - await Promise.all([liveSnapshot.archiveExisting(), liveSnapshot.saveNew()]); + await liveSnapshot.archiveExisting(); + await liveSnapshot.saveNew(); liveWebsites = null; + liveSnapshot = null; this.logger.log('Live snapshot archived and saved.'); } @@ -69,7 +71,7 @@ export class SnapshotService { `Total number of all websites retrieved for snapshot: ${allWebsites.length}`, ); - const allSnapshot = new Snapshot( + let allSnapshot = new Snapshot( this.storageService, [new JsonSerializer(columns), new CsvSerializer(columns)], allWebsites, @@ -77,9 +79,11 @@ export class SnapshotService { this.fileNameAll, ); - await Promise.all([allSnapshot.archiveExisting(), allSnapshot.saveNew()]); + await allSnapshot.archiveExisting(); + await allSnapshot.saveNew(); allWebsites = null; + allSnapshot = null; this.logger.log('All snapshot archived and saved.'); }