From 3758ec82650d061fee331bf7cc4339350f215d6e Mon Sep 17 00:00:00 2001 From: oetiker Date: Sat, 8 Aug 2009 09:28:43 +0000 Subject: [PATCH] The current method may have caused flushes (and journal rotations) more often than necessary. The problem was introduced in r1600. --kevin git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1881 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_daemon.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/program/src/rrd_daemon.c b/program/src/rrd_daemon.c index 36701f89..2a35ec2a 100644 --- a/program/src/rrd_daemon.c +++ b/program/src/rrd_daemon.c @@ -820,14 +820,15 @@ static void *flush_thread_main (void *args __attribute__((unused))) /* {{{ */ || ((now.tv_sec == next_flush.tv_sec) && ((1000 * now.tv_usec) > next_flush.tv_nsec))) { + RRDD_LOG(LOG_DEBUG, "flushing old values"); + + /* Determine the time of the next cache flush. */ + next_flush.tv_sec = now.tv_sec + config_flush_interval; + /* Flush all values that haven't been written in the last * `config_write_interval' seconds. */ flush_old_values (config_write_interval); - /* Determine the time of the next cache flush. */ - next_flush.tv_sec = - now.tv_sec + next_flush.tv_sec % config_flush_interval; - /* unlock the cache while we rotate so we don't block incoming * updates if the fsync() blocks on disk I/O */ pthread_mutex_unlock(&cache_lock); -- 2.30.2