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