Created
June 21, 2019 11:49
-
-
Save phenomnomnominal/4df87a3c2a6f377eca0e676b4c53a672 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const LOCATIONS = { /* ... */ }; | |
const LOCATION_NAMES = Object.keys(LOCATIONS); | |
const ALL_APPOINTMENTS = {}; | |
console.log('πΈπͺπ Info: Starting loop!'); | |
let index = 0; | |
setInterval(() => { | |
getAppointmentsForLocation(LOCATION_NAMES[index]); | |
if (index === LOCATION_NAMES.length - 1) { | |
index = 0; | |
return; | |
} | |
index = index + 1; | |
}, 5000); | |
let hasInitialised = false; | |
setTimeout(() => { | |
console.log('πΈπͺπ Info: Assuming stable, will start sending emails now!'); | |
hasInitialised = true; | |
const events = Object.keys(ALL_APPOINTMENTS).map(key => { | |
ALL_APPOINTMENTS[key].key = key; | |
return ALL_APPOINTMENTS[key]; | |
}); | |
}, 120000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment