X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrdtool.c;h=2a1a569888bd2fc6b100b2dd9e392d6356533d21;hb=c7cbb2af24de8b33186dd45b5731b87ea7152173;hp=d357cad0f460734f56991e9045f7d148711c8434;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f;p=collectd.git diff --git a/src/rrdtool.c b/src/rrdtool.c index d357cad0..2a1a5698 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -505,7 +505,6 @@ static void rrd_cache_flush(cdtime_t timeout) { CDTIME_T_TO_DOUBLE(timeout)); now = cdtime(); - timeout = TIME_T_TO_CDTIME_T(timeout); /* Build a list of entries to be flushed */ iter = c_avl_get_iterator(cache); @@ -740,7 +739,7 @@ static int rrd_cache_insert(const char *filename, const char *value, if ((cache_timeout > 0) && ((cdtime() - cache_flush_last) > cache_flush_timeout)) - rrd_cache_flush(cache_flush_timeout); + rrd_cache_flush(cache_timeout); pthread_mutex_unlock(&cache_lock); @@ -885,7 +884,7 @@ static int rrd_config(const char *key, const char *value) { "be greater than 0.\n"); return (1); } - cache_flush_timeout = tmp; + cache_flush_timeout = TIME_T_TO_CDTIME_T(tmp); } else if (strcasecmp("DataDir", key) == 0) { char *tmp; size_t len; @@ -1066,8 +1065,14 @@ static int rrd_init(void) { cache_flush_last = cdtime(); if (cache_timeout == 0) { cache_flush_timeout = 0; - } else if (cache_flush_timeout < cache_timeout) + } else if (cache_flush_timeout < cache_timeout) { + INFO("rrdtool plugin: \"CacheFlush %u\" is less than \"CacheTimeout %u\". " + "Ajusting \"CacheFlush\" to %u seconds.", + (unsigned int)CDTIME_T_TO_TIME_T(cache_flush_timeout), + (unsigned int)CDTIME_T_TO_TIME_T(cache_timeout), + (unsigned int)CDTIME_T_TO_TIME_T(cache_timeout * 10)); cache_flush_timeout = 10 * cache_timeout; + } pthread_mutex_unlock(&cache_lock);