Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Created June 21, 2019 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phenomnomnominal/4df87a3c2a6f377eca0e676b4c53a672 to your computer and use it in GitHub Desktop.
Save phenomnomnominal/4df87a3c2a6f377eca0e676b4c53a672 to your computer and use it in GitHub Desktop.
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