|
|
@@ -103,7 +103,9 @@ export class TaskService implements OnModuleInit {
|
|
|
task.status = TaskStatus.InProgress
|
|
|
await this.taskRepository.save(task)
|
|
|
for (let accountId of task.accounts) {
|
|
|
+ let i = 0
|
|
|
for (let taskItem of task.items) {
|
|
|
+ i++
|
|
|
const taskLog = new TaskLog()
|
|
|
taskLog.taskId = task.id
|
|
|
taskLog.accountId = accountId
|
|
|
@@ -211,7 +213,10 @@ export class TaskService implements OnModuleInit {
|
|
|
task.progress += 1
|
|
|
await this.taskRepository.save(task)
|
|
|
this.eventEmitter.emit('refreshBalance', accountId)
|
|
|
- await setTimeout(parseInt(randomAmount(task.delay.min, task.delay.max, 0)))
|
|
|
+ if (i < task.items.length) {
|
|
|
+ let random = randomAmount(task.delay.min, task.delay.max, 0)
|
|
|
+ await setTimeout(1000 * parseInt(random))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
task.status = TaskStatus.Done
|