Skip to content

Commit

Permalink
fix(server): fix billing task perf problem (#1236)
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow authored Jun 10, 2023
1 parent 1f1f7ba commit 43e721f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/src/billing/billing-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export class BillingTaskService {
},
})

const concurrency = total > 10 ? 10 : total
if (total > 10) {
const concurrency = total > 1 ? 1 : total
if (total > 1) {
setTimeout(() => {
this.createBillingScheduler()
}, 2000)
}, 1000)
}

times(concurrency, () => {
Expand All @@ -70,11 +70,11 @@ export class BillingTaskService {
lockedAt: { $lt: new Date(Date.now() - 1000 * 60) },
})

const concurrency = total > 10 ? 10 : total
if (total > 10) {
const concurrency = total > 1 ? 1 : total
if (total > 1) {
setTimeout(() => {
this.payBillingScheduler()
}, 2000)
}, 1000)
}

times(concurrency, () => {
Expand Down

0 comments on commit 43e721f

Please sign in to comment.