properly log timing different when hibernation is detected
Costa Tsaousis (ktsaou) committed
Apr 22, 2017 at 01:23 UTC
2fb3ec180068b8631d6df395e024447e58bed9db
1 file changed
+9
-4
src/health.c
+9
-4
@@ -356,9 +356,16 @@ void *health_main(void *ptr) {
356
357
// detect if boottime and realtime have twice the difference
358
// in which case we assume the system was just waken from hibernation
359
- if(unlikely(now - last_now > 2 * (now_boottime - last_now_boottime)))
359
+ if(unlikely(now - last_now > 2 * (now_boottime - last_now_boottime))) {
360
apply_hibernation_delay = 1;
361
362
+ info("Postponing alarm checks for %ld seconds, due to boottime discrepancy (realtime dt: %ld, boottime dt: %ld)."
363
+ , hibernation_delay
364
+ , (long)(now - last_now)
365
+ , (long)(now_boottime - last_now_boottime)
366
+ );
367
+ }
368
+
369
last_now = now;
370
last_now_boottime = now_boottime;
371
@@ -374,11 +381,9 @@ void *health_main(void *ptr) {
381
382
if(unlikely(apply_hibernation_delay)) {
383
377
- info("Postponing alarm checks for %ld seconds, on host '%s', due to boottime discrepancy (realtime dt: %ld, boottime dt: %ld)."
384
+ info("Postponing alarm checks for %ld seconds, on host '%s'."
385
, hibernation_delay
386
, host->hostname
380
- , (long)(now - last_now)
381
- , (long)(now_boottime - last_now_boottime)
387
);
388
389
host->health_delay_up_to = now + hibernation_delay;