clear data individually instead of all at once

This commit is contained in:
2025-01-16 21:29:51 -08:00
parent 6176dd9f5a
commit e4b08be1e4

View File

@@ -48,11 +48,15 @@ export class RepositoryDataLoader {
if (!this.shouldBeRunning) return; if (!this.shouldBeRunning) return;
try { try {
await this.clearAllData(); await this.repository.clearSystemData();
await this.fetchAndUpdateSystemData(); await this.fetchAndUpdateSystemData();
await this.repository.clearRouteData();
await this.fetchAndUpdateRouteDataForExistingSystems(); await this.fetchAndUpdateRouteDataForExistingSystems();
await this.repository.clearStopData();
await this.fetchAndUpdateStopAndPolylineDataForRoutesInExistingSystems(); await this.fetchAndUpdateStopAndPolylineDataForRoutesInExistingSystems();
await this.repository.clearShuttleData();
await this.fetchAndUpdateShuttleDataForExistingSystems(); await this.fetchAndUpdateShuttleDataForExistingSystems();
await this.repository.clearEtaData();
await this.fetchAndUpdateEtaDataForExistingOrderedStops(); await this.fetchAndUpdateEtaDataForExistingOrderedStops();
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@@ -61,15 +65,6 @@ export class RepositoryDataLoader {
this.timer = setTimeout(this.startFetchDataAndUpdate, timeout); 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() { private async fetchAndUpdateSystemData() {
const params = { const params = {
getSystems: "2", getSystems: "2",