|
|
@@ -898,7 +898,7 @@ export class TaskService implements OnModuleInit {
|
|
|
const maxParallel = await this.getConfig('max_parallel', 1)
|
|
|
const batchSize = 200
|
|
|
|
|
|
- const tasks = await this.taskRepository.find({
|
|
|
+ let tasks = await this.taskRepository.find({
|
|
|
where: {
|
|
|
status: TaskStatus.PENDING
|
|
|
},
|
|
|
@@ -960,6 +960,7 @@ export class TaskService implements OnModuleInit {
|
|
|
tasks.push(...cuttingTasks)
|
|
|
}
|
|
|
if (tasks.length === 0) return
|
|
|
+ tasks = tasks.sort((a, b) => Math.random() - Math.random())
|
|
|
const devices = await this.deviceService.findAllAvailableDevices()
|
|
|
if (devices.length === 0) return
|
|
|
const countryMapping: { [key: string]: string[] } = JSON.parse(
|