Skip to content

Commit

Permalink
Break Snapshot class method calls out of Promise.all
Browse files Browse the repository at this point in the history
  • Loading branch information
akuny committed Apr 4, 2024
1 parent 61f3121 commit aea8080
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libs/snapshot/src/snapshot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ 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,
date,
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.');
}
Expand All @@ -69,17 +71,19 @@ 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,
date,
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.');
}
Expand Down

0 comments on commit aea8080

Please sign in to comment.