in packages/@prototype/simulator/src/SimulatorManagerStack/StatisticsLambda/@lambda/src/builders/providerManager.js [47:70]
ORDER_UPDATE: async (providerName, detail) => {
const timestamp = Date.now()
const { orderId, status } = detail
let statusList = await client.keys(`${PROVIDER_DISTRIBUTION}:${providerName}:*`)
statusList = (statusList || []).map(q => q.split(':').pop())
if (statusList.length === 0) {
statusList = [status]
}
if (!statusList.includes(status)) {
statusList.push(status)
}
const promises = statusList.map((s) => {
if (s === status) {
return client.hset(`${PROVIDER_DISTRIBUTION}:${providerName}:${s}`, orderId, timestamp)
}
return client.hdel(`${PROVIDER_DISTRIBUTION}:${providerName}:${s}`, orderId)
})
await Promise.all(promises)
},