Created
April 21, 2021 04:06
-
-
Save j05u3/cd51d1d08c6eb8bb63c0aa1ee337e7fc to your computer and use it in GitHub Desktop.
Timeout tests for Google Cloud Functions
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
// 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