Skip to content

Commit

Permalink
Wait 2s in between synchronization with calendar server
Browse files Browse the repository at this point in the history
New rate limits prevent sending too many requests to W3C servers. To stay
below the 180 requests/minutes threshold, calendar synchronization now
sleeps for 2s after processing a session.

Note: a session issue may be linked to more than one calendar entry. These
calendar entries are processed one after the other without sleeping.
  • Loading branch information
tidoust committed Jun 18, 2024
1 parent 9087775 commit 715d220
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/commands/sync-calendar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { getEnvKey } from '../lib/envkeys.mjs';
import { synchronizeSessionWithCalendar } from '../lib/calendar.mjs';
import { validateSession, validateGrid } from '../lib/validate.mjs';

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms, 'slept'));
}

export default async function (project, number, options) {
const sessionToSynchronize =
(number.trim().toLowerCase() === 'all') ?
Expand Down Expand Up @@ -58,6 +62,9 @@ export default async function (project, number, options) {
roomZoom: project.roomZoom
});
console.warn(`Convert session ${session.number} to calendar entries... done`);
console.warn('Wait 2s to ease load on calendar server...');
await sleep(2000);
console.warn('Wait 2s to ease load on calendar server... done');
}
}
finally {
Expand Down

0 comments on commit 715d220

Please sign in to comment.