Reduce info logs frequency from T=1s to T=5s
This commit is contained in:
parent
6a98a26fc5
commit
071be441c1
|
|
@ -396,6 +396,9 @@ void* den_service(void *fc) {
|
|||
den->events[i] = calloc(1, sizeof(event_t));
|
||||
}
|
||||
|
||||
uint32_t sleep4us = 5e5;
|
||||
uint32_t sleep_count = 0;
|
||||
|
||||
while (!facilities->exit) {
|
||||
clock_gettime(CLOCK_REALTIME, &systemtime);
|
||||
now = (long)(systemtime.tv_sec * 1000 + systemtime.tv_nsec / 1E6);
|
||||
|
|
@ -434,11 +437,15 @@ void* den_service(void *fc) {
|
|||
}
|
||||
}
|
||||
|
||||
if (sleep4us * sleep_count > 5e6) { /* Print info every 5 seconds */
|
||||
syslog_info("[facilities] [den] events :: [ %d active | %d cancelled | %d negated ]", den->n_active_events, den->n_cancelled_events, den->n_negated_events);
|
||||
sleep_count = 0;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&den->lock);
|
||||
|
||||
usleep(1000000);
|
||||
++sleep_count;
|
||||
usleep(sleep4us);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -525,6 +525,9 @@ void* infrastructure_service(void *fc) {
|
|||
infrastructure->services[i] = calloc(1, sizeof(service_t));
|
||||
}
|
||||
|
||||
uint32_t sleep4us = 5e5;
|
||||
uint32_t sleep_count = 0;
|
||||
|
||||
while (!facilities->exit) {
|
||||
clock_gettime(CLOCK_REALTIME, &systemtime);
|
||||
now = (long)(systemtime.tv_sec * 1000 + systemtime.tv_nsec / 1E6);
|
||||
|
|
@ -569,11 +572,15 @@ void* infrastructure_service(void *fc) {
|
|||
}
|
||||
}
|
||||
|
||||
if (sleep_count * sleep4us > 5e6) { /* Print info every 5 seconds */
|
||||
syslog_info("[facilities] [infrastructure] services :: [ %d active | %d awaiting | %d cancelled | %d negated ]", infrastructure->n_active_services - n_awaiting_services, n_awaiting_services, infrastructure->n_cancelled_services, infrastructure->n_negated_services);
|
||||
sleep_count = 0;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&infrastructure->lock);
|
||||
|
||||
usleep(1000000);
|
||||
++sleep_count;
|
||||
usleep(sleep4us);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue