Commit 18586efc2918dc90bce746e9c9d3df675a020911
1 parent
e6cce2b502
Exists in
master
More detail on terminating
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
lib/modem.js
... | ... | @@ -44,7 +44,7 @@ let lastTs = new Date(); |
44 | 44 | |
45 | 45 | const port = new SerialPort(config.modem.device, { baudRate: 115200 }, (err) => { |
46 | 46 | if (err) { |
47 | - logger.warn(`Error opening modem. ${err}. Terminating.`); | |
47 | + logger.warn(`Error opening modem. ${err}. Terminating modem ${config.modem.device}.`); | |
48 | 48 | process.exit(1); |
49 | 49 | } |
50 | 50 | }); |
... | ... | @@ -229,7 +229,7 @@ function readIMSI() { |
229 | 229 | } |
230 | 230 | } |
231 | 231 | else { |
232 | - logger.warn('IMSI not detected. Please insert a sim card to your modem.'); | |
232 | + logger.warn(`IMSI not detected. Please insert a sim card to your modem. Terminating ${config.modem.device}.`); | |
233 | 233 | process.exit(2); |
234 | 234 | } |
235 | 235 | resolve(result); |
... | ... | @@ -314,9 +314,9 @@ async function sendSMS(destination, msg) { |
314 | 314 | } |
315 | 315 | |
316 | 316 | function init() { |
317 | - setTimeout(() => { | |
317 | + setInterval(() => { | |
318 | 318 | if ((new Date() - lastTs) > MAX_LAST_DATA_AGE_MS) { |
319 | - logger.warn(`No data for more than ${MAX_LAST_DATA_AGE_MS} ms. Modem might be unresponsive. Terminating.`); | |
319 | + logger.warn(`No data for more than ${MAX_LAST_DATA_AGE_MS} ms. Modem might be unresponsive. Terminating modem ${config.modem.device}.`); | |
320 | 320 | process.exit(0); |
321 | 321 | } |
322 | 322 | }, 30 * 1000); |