decrease sleep time of graphite loop

pull/101/head
Richard Fuchs 11 years ago
parent 965d989c93
commit 7175a261ca

@ -18,6 +18,7 @@ static u_int32_t graphite_ipaddress;
static int graphite_port=0; static int graphite_port=0;
static struct callmaster* cm=0; static struct callmaster* cm=0;
//struct totalstats totalstats_prev; //struct totalstats totalstats_prev;
static time_t g_now, next_run;
int connect_to_graphite_server(u_int32_t ipaddress, int port) { int connect_to_graphite_server(u_int32_t ipaddress, int port) {
@ -120,6 +121,12 @@ void graphite_loop_run(struct callmaster* callmaster, int seconds) {
int rc=0; int rc=0;
g_now = time(NULL);
if (g_now < next_run)
goto sleep;
next_run = g_now + seconds;
if (!cm) if (!cm)
cm = callmaster; cm = callmaster;
@ -134,5 +141,6 @@ void graphite_loop_run(struct callmaster* callmaster, int seconds) {
} }
} }
sleep(seconds); sleep:
usleep(100000);
} }

Loading…
Cancel
Save