Merge pull request #5 from brendan-ch/chore/enable-data-updates

chore/enable-data-updates
This commit is contained in:
2025-01-15 22:03:12 -08:00
committed by GitHub

View File

@@ -22,10 +22,13 @@ const baseUrl = "https://passiogo.com/mapGetData.php";
export class RepositoryDataLoader {
private shouldBeRunning: boolean = false;
private timer: any;
constructor(
private repository: GetterSetterRepository,
) {}
) {
this.startFetchDataAndUpdate = this.startFetchDataAndUpdate.bind(this);
}
public async start() {
if (this.shouldBeRunning) {
@@ -52,11 +55,9 @@ export class RepositoryDataLoader {
await this.fetchAndUpdateEtaDataForExistingOrderedStops();
} catch (e) {
console.error(e);
} finally {
// TODO test if memoization of shouldBeRunning works as intended,
// I have no idea how JavaScript works
// setTimeout(this.startFetchDataAndUpdate, timeout);
}
this.timer = setTimeout(this.startFetchDataAndUpdate, timeout);
}
private async fetchAndUpdateSystemData() {