Skip to content

Instantly share code, notes, and snippets.

@scroobius-pip
Created September 10, 2020 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scroobius-pip/e0c3d3acf290852cc8471bba88ab8d41 to your computer and use it in GitHub Desktop.
Save scroobius-pip/e0c3d3acf290852cc8471bba88ab8d41 to your computer and use it in GitHub Desktop.
async function findOrCreateUser(id){
const user = await findUser(id)
if(!user){
return await createUser(id)
}
return user
}
async function getUsers(idList){
const { results, errors } = await PromisePool
.for(idList)
.withConcurrency(100)
.process(findOrCreateUser)
return results
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment