add more logs
This commit is contained in:
+38
-34
@@ -193,6 +193,7 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startForwordingForDevice(device) {
|
function startForwordingForDevice(device) {
|
||||||
|
console.log("startForwordingForDevice() called")
|
||||||
const execSync = require('child_process').execSync;
|
const execSync = require('child_process').execSync;
|
||||||
// get attributed port
|
// get attributed port
|
||||||
let attributedPort = device_port_info[device.serial()]
|
let attributedPort = device_port_info[device.serial()]
|
||||||
@@ -217,41 +218,44 @@ async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathT
|
|||||||
let sender = new Sender()
|
let sender = new Sender()
|
||||||
sender.initConnection().then((r) => {
|
sender.initConnection().then((r) => {
|
||||||
console.log("queue connected")
|
console.log("queue connected")
|
||||||
mongoManager.connect().then(r => {
|
console.log("connect to mongodb")
|
||||||
filterAlreadyBookedContacts(contactList).then((listToBook) => {
|
mongoManager.connect().then(r => {
|
||||||
filterAlreadyAcceptedContacts(listToBook).then(notAcceptedContacts => {
|
console.log("successfully connected to mongodb")
|
||||||
filterBlacklistedContacts(notAcceptedContacts).then(listWithoutBlackContact => {
|
|
||||||
console.log("number of contacts to book:" + listWithoutBlackContact.length)
|
filterAlreadyBookedContacts(contactList).then((listToBook) => {
|
||||||
android.devices().then((devices) => {
|
filterAlreadyAcceptedContacts(listToBook).then(notAcceptedContacts => {
|
||||||
if (devices.length === 0) {
|
filterBlacklistedContacts(notAcceptedContacts).then(listWithoutBlackContact => {
|
||||||
alert("未找到连接的设备");
|
console.log("number of contacts to book:" + listWithoutBlackContact.length)
|
||||||
return
|
android.devices().then((devices) => {
|
||||||
}
|
if (devices.length === 0) {
|
||||||
let device_to_excludes = three_to_excludes;
|
alert("未找到连接的设备");
|
||||||
if (excludeMode === DeviceExcludeMode.FOUR) {
|
return
|
||||||
device_to_excludes = four_to_excludes;
|
}
|
||||||
} else if (excludeMode === DeviceExcludeMode.NINE) {
|
let device_to_excludes = three_to_excludes;
|
||||||
device_to_excludes = nine_to_excludes;
|
if (excludeMode === DeviceExcludeMode.FOUR) {
|
||||||
} else if (excludeMode === DeviceExcludeMode.SEVEN) {
|
device_to_excludes = four_to_excludes;
|
||||||
device_to_excludes = seven_to_excludes
|
} else if (excludeMode === DeviceExcludeMode.NINE) {
|
||||||
} else if (excludeMode === DeviceExcludeMode.SIX) {
|
device_to_excludes = nine_to_excludes;
|
||||||
device_to_excludes = six_to_excludes
|
} else if (excludeMode === DeviceExcludeMode.SEVEN) {
|
||||||
}
|
device_to_excludes = seven_to_excludes
|
||||||
filteredDeviceList = devices.filter(device => !device_to_excludes.includes(device.serial()))
|
} else if (excludeMode === DeviceExcludeMode.SIX) {
|
||||||
let segmentNumber = listWithoutBlackContact.length / filteredDeviceList.length;
|
device_to_excludes = six_to_excludes
|
||||||
console.log("connected device number:" + filteredDeviceList.length)
|
}
|
||||||
console.log("segmentNumber:" + segmentNumber)
|
filteredDeviceList = devices.filter(device => !device_to_excludes.includes(device.serial()))
|
||||||
for (let i = 0; i < filteredDeviceList.length; i++) {
|
let segmentNumber = listWithoutBlackContact.length / filteredDeviceList.length;
|
||||||
let device = filteredDeviceList[i];
|
console.log("connected device number:" + filteredDeviceList.length)
|
||||||
let port = startForwordingForDevice(device)
|
console.log("segmentNumber:" + segmentNumber)
|
||||||
startWithList(listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)), device, sender, selectedStore, audioAnalyse, alertBeep, port);
|
for (let i = 0; i < filteredDeviceList.length; i++) {
|
||||||
}
|
let device = filteredDeviceList[i];
|
||||||
})
|
let port = startForwordingForDevice(device)
|
||||||
|
startWithList(listWithoutBlackContact.slice(i * segmentNumber, segmentNumber * (i + 1)), device, sender, selectedStore, audioAnalyse, alertBeep, port);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
)
|
}
|
||||||
})
|
)
|
||||||
});
|
})
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -9,7 +9,9 @@ class Sender {
|
|||||||
connection;
|
connection;
|
||||||
|
|
||||||
async initConnection() {
|
async initConnection() {
|
||||||
this.connection = await amqp.connect(QUEUE_HOST);
|
this.connection = await amqp.connect(QUEUE_HOST, {
|
||||||
|
timeout: 15000
|
||||||
|
});
|
||||||
this.channel = await this.connection.createChannel();
|
this.channel = await this.connection.createChannel();
|
||||||
await this.channel.assertQueue(REQUEST_DATA_QUEUE_FR, {persistent: true});
|
await this.channel.assertQueue(REQUEST_DATA_QUEUE_FR, {persistent: true});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user