Commit b3b28d49f74865bfcb483d4572794e4a91d2189c

Authored by Adhidarma Hadiwinoto
1 parent 0ea228ab65
Exists in master

MODEM-INFO idle check include lastReadTs criteria

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

... ... @@ -23,7 +23,11 @@ const modemInfo = {
23 23  
24 24 if (!config.disable_idle_check) {
25 25 setInterval(() => {
26   - const deltaMs = new Date() - Math.max(modemInfo.lastWriteTs, modemInfo.startTime);
  26 + const deltaMs = new Date() - Math.max(
  27 + modemInfo.startTime,
  28 + Math.min(modemInfo.lastWriteTs, modemInfo.lastReadTs),
  29 + );
  30 +
27 31 if (deltaMs >= (config.max_last_data_age_ms || DEFAULT_MAX_LAST_DATA_AGE_MS)) {
28 32 logger.warn(`Modem idle for ${deltaMs} ms. Modem stucked? Terminating!`);
29 33 process.exit(1);