projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #38 from octo/ff/mongodb
[collectd.git]
/
src
/
amqp.c
diff --git
a/src/amqp.c
b/src/amqp.c
index
f0abd44
..
be1f709
100644
(file)
--- a/
src/amqp.c
+++ b/
src/amqp.c
@@
-550,19
+550,25
@@
static void *camqp_subscribe_thread (void *user_data) /* {{{ */
status = camqp_connect (conf);
if (status != 0)
{
status = camqp_connect (conf);
if (status != 0)
{
+ struct timespec ts_interval;
ERROR ("amqp plugin: camqp_connect failed. "
ERROR ("amqp plugin: camqp_connect failed. "
- "Will sleep for %i seconds.", interval_g);
- sleep (interval_g);
+ "Will sleep for %.3f seconds.",
+ CDTIME_T_TO_DOUBLE (interval_g));
+ CDTIME_T_TO_TIMESPEC (interval_g, &ts_interval);
+ nanosleep (&ts_interval, /* remaining = */ NULL);
continue;
}
status = amqp_simple_wait_frame (conf->connection, &frame);
if (status < 0)
{
continue;
}
status = amqp_simple_wait_frame (conf->connection, &frame);
if (status < 0)
{
+ struct timespec ts_interval;
ERROR ("amqp plugin: amqp_simple_wait_frame failed. "
ERROR ("amqp plugin: amqp_simple_wait_frame failed. "
- "Will sleep for %i seconds.", interval_g);
+ "Will sleep for %.3f seconds.",
+ CDTIME_T_TO_DOUBLE (interval_g));
camqp_close_connection (conf);
camqp_close_connection (conf);
- sleep (interval_g);
+ CDTIME_T_TO_TIMESPEC (interval_g, &ts_interval);
+ nanosleep (&ts_interval, /* remaining = */ NULL);
continue;
}
continue;
}