|
@@ -572,8 +572,7 @@ export class TaskService implements OnModuleInit {
|
|
|
if (durianRes.data.code === 200) {
|
|
if (durianRes.data.code === 200) {
|
|
|
res.durian = durianRes.data.data.score
|
|
res.durian = durianRes.data.data.score
|
|
|
}
|
|
}
|
|
|
- } catch (e) {
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } catch (e) {}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const cloudInstance = axios.create({
|
|
const cloudInstance = axios.create({
|
|
@@ -847,6 +846,8 @@ export class TaskService implements OnModuleInit {
|
|
|
taskItems.forEach((item) => {
|
|
taskItems.forEach((item) => {
|
|
|
item.message = this.getMessage(task)
|
|
item.message = this.getMessage(task)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ devices = devices.splice(0, Math.ceil(taskItems.length / 5))
|
|
|
const taskConfig = {
|
|
const taskConfig = {
|
|
|
rcsWait: task.rcsWait || (await this.getConfig('rcs_wait', 2000)),
|
|
rcsWait: task.rcsWait || (await this.getConfig('rcs_wait', 2000)),
|
|
|
rcsInterval: task.rcsInterval || (await this.getConfig('rcs_interval', 3000)),
|
|
rcsInterval: task.rcsInterval || (await this.getConfig('rcs_interval', 3000)),
|
|
@@ -855,13 +856,18 @@ export class TaskService implements OnModuleInit {
|
|
|
checkConnection: task.checkConnection,
|
|
checkConnection: task.checkConnection,
|
|
|
useBackup: task.useBackup
|
|
useBackup: task.useBackup
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ await this.updateTaskItemStatusAndSendAt(
|
|
|
|
|
+ taskItems.map((i) => i.id),
|
|
|
|
|
+ TaskItemStatus.PENDING
|
|
|
|
|
+ )
|
|
|
|
|
+ await this.deviceService.updateDevices(
|
|
|
|
|
+ devices.map((d) => d.id),
|
|
|
|
|
+ { busy: true }
|
|
|
|
|
+ )
|
|
|
Promise.all(
|
|
Promise.all(
|
|
|
devices.map(async (device, i) => {
|
|
devices.map(async (device, i) => {
|
|
|
const items = taskItems.slice(i * 5, i * 5 + 5)
|
|
const items = taskItems.slice(i * 5, i * 5 + 5)
|
|
|
- await this.updateTaskItemStatusAndSendAt(
|
|
|
|
|
- items.map((i) => i.id),
|
|
|
|
|
- TaskItemStatus.PENDING
|
|
|
|
|
- )
|
|
|
|
|
try {
|
|
try {
|
|
|
const res: any = await Promise.race([
|
|
const res: any = await Promise.race([
|
|
|
this.eventsGateway.sendForResult(
|
|
this.eventsGateway.sendForResult(
|