incyclist-services 1.0.66 → 1.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -478,6 +478,7 @@ class DeviceRideService extends events_1.default {
|
|
|
478
478
|
const isPaused = ai.adapter.isPaused();
|
|
479
479
|
if (isPaused || !ai.tsLastData) {
|
|
480
480
|
ai.tsLastData = tsNow;
|
|
481
|
+
ai.dataStatus = 'green';
|
|
481
482
|
return;
|
|
482
483
|
}
|
|
483
484
|
const prevStatus = ai.dataStatus;
|
|
@@ -500,7 +501,8 @@ class DeviceRideService extends events_1.default {
|
|
|
500
501
|
this.logEvent({ message: 'device healthy', device: ai.adapter.getUniqueName(), udid: ai.udid });
|
|
501
502
|
this.emit('healthy', ai.udid, ai.dataStatus, enabledCapabilities);
|
|
502
503
|
}
|
|
503
|
-
if (isAmber && prevStatus === 'green') {
|
|
504
|
+
if ((isAmber || isRed) && prevStatus === 'green') {
|
|
505
|
+
console.log('~~~~ health check: prepare reconnect');
|
|
504
506
|
this.prepareReconnect(ai);
|
|
505
507
|
}
|
|
506
508
|
};
|
|
@@ -518,13 +520,16 @@ class DeviceRideService extends events_1.default {
|
|
|
518
520
|
return __awaiter(this, void 0, void 0, function* () {
|
|
519
521
|
if (ai.isRestarting)
|
|
520
522
|
return;
|
|
523
|
+
console.log('~~~~ health check: wait 45s', ai.udid);
|
|
521
524
|
yield (0, sleep_1.sleep)(UNHEALTHY_THRESHOLD - NO_DATA_THRESHOLD - 5000);
|
|
525
|
+
console.log('~~~~ health check: check if still unhealthy', ai.udid, ai.isHealthy, ai.isRestarting);
|
|
522
526
|
if (ai.isHealthy || ai.isRestarting)
|
|
523
527
|
return;
|
|
524
528
|
const ifName = ai.adapter.getInterface();
|
|
525
529
|
const adapters = this.getAdapterList().filter(ai => ai.adapter.getInterface() === ifName);
|
|
526
530
|
ai.isRestarting = true;
|
|
527
531
|
if (!adapters.find(ai => ai.isHealthy)) {
|
|
532
|
+
console.log('~~~~ health check: restart interface', ifName);
|
|
528
533
|
this.logger.logEvent({ message: 'restart interface', interface: ifName });
|
|
529
534
|
const i = incyclist_devices_1.InterfaceFactory.create(ifName);
|
|
530
535
|
try {
|
|
@@ -555,6 +560,7 @@ class DeviceRideService extends events_1.default {
|
|
|
555
560
|
});
|
|
556
561
|
}
|
|
557
562
|
else {
|
|
563
|
+
console.log('~~~~ health check: restart adapter', ai.udid);
|
|
558
564
|
this.logger.logEvent({ message: 'restart adapter', device: ai.udid });
|
|
559
565
|
ai.adapter.off('data', this.deviceDataHandler);
|
|
560
566
|
const adapter = ai.adapter;
|