mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Merge pull request #5 from brendan-ch/chore/enable-data-updates
chore/enable-data-updates
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user