Batched wait all userRecommendations
This commit is contained in:
parent
16ae447823
commit
7e8ac0fc8f
|
@ -11,6 +11,7 @@ import {
|
||||||
getContractScores,
|
getContractScores,
|
||||||
getWordScores,
|
getWordScores,
|
||||||
} from '../../common/recommended-contracts'
|
} from '../../common/recommended-contracts'
|
||||||
|
import { batchedWaitAll } from '../../common/util/promise'
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
@ -23,7 +24,9 @@ export const updateRecommendations = functions.pubsub
|
||||||
|
|
||||||
const users = await getValues<User>(firestore.collection('users'))
|
const users = await getValues<User>(firestore.collection('users'))
|
||||||
|
|
||||||
for (const user of users) await updateUserRecommendations(user, contracts)
|
await batchedWaitAll(
|
||||||
|
users.map((user) => () => updateUserRecommendations(user, contracts))
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export const updateUserRecommendations = async (
|
export const updateUserRecommendations = async (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user