Fix auto resolve markets query
This commit is contained in:
parent
38c63fb3ee
commit
b405bd453a
|
@ -60,12 +60,14 @@ export const autoResolveMarkets = functions.pubsub
|
|||
firestore
|
||||
.collection('contracts')
|
||||
.where('isResolved', '==', false)
|
||||
.where('closeTime', '>', Date.now())
|
||||
.where('autoResolutionTime', '<', Date.now())
|
||||
)
|
||||
const closedContracts = contracts.filter(
|
||||
(c) => c.closeTime && c.closeTime < Date.now()
|
||||
)
|
||||
|
||||
await batchedWaitAll(
|
||||
contracts.map((contract) => async () => {
|
||||
closedContracts.map((contract) => async () => {
|
||||
const result = await autoResolve(contract)
|
||||
|
||||
console.log('resolved', contract.slug, 'result:', result)
|
||||
|
|
Loading…
Reference in New Issue
Block a user