Skip to content

Instantly share code, notes, and snippets.

@koyanloshe
Last active April 17, 2020 08:27
Show Gist options
  • Save koyanloshe/108a05d99f25fe2e79d966eb2afa9d9b to your computer and use it in GitHub Desktop.
Save koyanloshe/108a05d99f25fe2e79d966eb2afa9d9b to your computer and use it in GitHub Desktop.
Generate multiple requests #Javascript
const {promisify} = require('util')
const sleep = promisify(setTimeout)
const request = async(data) => {
let time = Math.random() * 1000
await sleep(time)
return {data, time}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment