diff --git a/functions/src/update-recommendations.ts b/functions/src/update-recommendations.ts index 2bbba46f..be5386df 100644 --- a/functions/src/update-recommendations.ts +++ b/functions/src/update-recommendations.ts @@ -11,6 +11,7 @@ import { getContractScores, getWordScores, } from '../../common/recommended-contracts' +import { batchedWaitAll } from '../../common/util/promise' const firestore = admin.firestore() @@ -23,7 +24,9 @@ export const updateRecommendations = functions.pubsub const users = await getValues(firestore.collection('users')) - for (const user of users) await updateUserRecommendations(user, contracts) + await batchedWaitAll( + users.map((user) => () => updateUserRecommendations(user, contracts)) + ) }) export const updateUserRecommendations = async (