mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-08-28 11:46:02 +08:00
Prevents campaign loading progress clobbering (#644)
This commit is contained in:
parent
d728ed2523
commit
0afe09da05
1 changed files with 4 additions and 4 deletions
|
@ -25,10 +25,6 @@ export default class CampaignGenerateListJob extends Job {
|
|||
// Approximate the size of the send list
|
||||
const estimatedSize = await estimatedSendSize(campaign)
|
||||
|
||||
// Use approximate size for progress
|
||||
await cacheSet<number>(App.main.redis, CacheKeys.populationTotal(campaign), estimatedSize, 86400)
|
||||
await cacheSet<number>(App.main.redis, CacheKeys.populationProgress(campaign), 0, 86400)
|
||||
|
||||
// Increase lock duration based on estimated send size
|
||||
const lockTime = Math.ceil(Math.max(estimatedSize / 1000, 900))
|
||||
logger.info({ id, estimatedSize, lockTime }, 'campaign:generate:estimated_size')
|
||||
|
@ -37,6 +33,10 @@ export default class CampaignGenerateListJob extends Job {
|
|||
logger.info({ id, acquired }, 'campaign:generate:lock')
|
||||
if (!acquired) return
|
||||
|
||||
// Use approximate size for progress
|
||||
await cacheSet<number>(App.main.redis, CacheKeys.populationTotal(campaign), estimatedSize, 86400)
|
||||
await cacheSet<number>(App.main.redis, CacheKeys.populationProgress(campaign), 0, 86400)
|
||||
|
||||
logger.info({ id }, 'campaign:generate:querying')
|
||||
await generateSendList(campaign)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue