From e4b08be1e4c2b0277fc5c833b142b25e6b92f316 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Thu, 16 Jan 2025 21:29:51 -0800 Subject: [PATCH] clear data individually instead of all at once --- src/loaders/RepositoryDataLoader.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/loaders/RepositoryDataLoader.ts b/src/loaders/RepositoryDataLoader.ts index efe4298..04e2c21 100644 --- a/src/loaders/RepositoryDataLoader.ts +++ b/src/loaders/RepositoryDataLoader.ts @@ -48,11 +48,15 @@ export class RepositoryDataLoader { if (!this.shouldBeRunning) return; try { - await this.clearAllData(); + await this.repository.clearSystemData(); await this.fetchAndUpdateSystemData(); + await this.repository.clearRouteData(); await this.fetchAndUpdateRouteDataForExistingSystems(); + await this.repository.clearStopData(); await this.fetchAndUpdateStopAndPolylineDataForRoutesInExistingSystems(); + await this.repository.clearShuttleData(); await this.fetchAndUpdateShuttleDataForExistingSystems(); + await this.repository.clearEtaData(); await this.fetchAndUpdateEtaDataForExistingOrderedStops(); } catch (e) { console.error(e); @@ -61,15 +65,6 @@ export class RepositoryDataLoader { this.timer = setTimeout(this.startFetchDataAndUpdate, timeout); } - private async clearAllData() { - await this.repository.clearRouteData(); - await this.repository.clearSystemData(); - await this.repository.clearEtaData(); - await this.repository.clearStopData(); - await this.repository.clearOrderedStopData(); - await this.repository.clearShuttleData(); - } - private async fetchAndUpdateSystemData() { const params = { getSystems: "2",