Skip to content

Commit

Permalink
Merge pull request #438 from people-os/add-delay2VO-invites
Browse files Browse the repository at this point in the history
Add a 1-sec delay between VO invites.
  • Loading branch information
flowzone-app[bot] authored Feb 2, 2024
2 parents 9098b93 + 7fbc9cb commit 4c84c39
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions helper-scripts/set-victorops-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ async function createScheduleOverrides(date, scheduleName) {

const v = new VictorOpsApiClient();

// Define a delay function that returns a Promise<void>
const delay = (ms: number): Promise<void> => {
return new Promise((resolve) => setTimeout(resolve, ms));
};

try {
const shiftsObject = await readAndParseJSONSchedule(date, scheduleName);

Expand Down Expand Up @@ -59,6 +64,8 @@ async function createScheduleOverrides(date, scheduleName) {
assignment.policy,
{ username: victoropsUsernames[shift.agentName.slice(1)] },
);
// Wait for 1 second before the next iteration
await delay(1000); // 1000 milliseconds = 1 second
}
}
}
Expand Down

0 comments on commit 4c84c39

Please sign in to comment.