Created
September 10, 2020 23:44
-
-
Save scroobius-pip/e0c3d3acf290852cc8471bba88ab8d41 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
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