Skip to content

Instantly share code, notes, and snippets.

@j05u3
Created April 21, 2021 04:06
Show Gist options
  • Save j05u3/cd51d1d08c6eb8bb63c0aa1ee337e7fc to your computer and use it in GitHub Desktop.
Save j05u3/cd51d1d08c6eb8bb63c0aa1ee337e7fc to your computer and use it in GitHub Desktop.
Timeout tests for Google Cloud Functions
// timeout tests
let times = [];
let n_times = 5;
let cnt = 0;
for (let i = 0; i < n_times; i++) {
setTimeout(() => {
const myI = i;
const now = Date.now();
times[myI] = now;
cnt++;
if (cnt == n_times) {
for (let j = 1; j < n_times; j++) {
console.log(times[j] - times[j - 1]);
}
}
}, i * 200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment