Parallelize ante creation
This commit is contained in:
parent
e01c7bd763
commit
d99928d16e
|
@ -121,7 +121,7 @@ export const createContract = functions
|
||||||
closeTime,
|
closeTime,
|
||||||
tags ?? [],
|
tags ?? [],
|
||||||
100,
|
100,
|
||||||
1,
|
0,
|
||||||
100
|
100
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -188,16 +188,18 @@ export const createContract = functions
|
||||||
ante
|
ante
|
||||||
)
|
)
|
||||||
|
|
||||||
for (let i = 0; i < antes.length; i++) {
|
await Promise.all(
|
||||||
|
antes.map(async (ante) => {
|
||||||
const anteBetDoc = firestore
|
const anteBetDoc = firestore
|
||||||
.collection(`contracts/${contract.id}/bets`)
|
.collection(`contracts/${contract.id}/bets`)
|
||||||
.doc()
|
.doc()
|
||||||
|
|
||||||
await anteBetDoc.set({
|
await anteBetDoc.set({
|
||||||
id: anteBetDoc.id,
|
id: anteBetDoc.id,
|
||||||
...antes[i],
|
...ante,
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user