-
-
Save Jarred-Sumner/d1cd803fc33023a4dfa557357613ac84 to your computer and use it in GitHub Desktop.
This file contains 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
const options = { | |
keepalive: true, | |
}; | |
var i = 0; | |
var lastSecond = 0; | |
function dump() { | |
if (lastSecond > 0) console.log(i - lastSecond, "req/s"); | |
lastSecond = i; | |
} | |
setInterval(dump, 1000); | |
const url = "http://localhost:3000/"; | |
while (true) { | |
try { | |
const array = [ | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
fetch(url, options), | |
]; | |
await Promise.all(array); | |
i += array.length; | |
} catch (e) { | |
console.error(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment