From: Florian Forster Date: Thu, 20 Jul 2017 07:12:14 +0000 (+0200) Subject: Merge branch 'collectd-5.7' X-Git-Tag: collectd-5.8.0~112 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c99e3a4d169ada9299c73e20662d17debdc32e1f;p=collectd.git Merge branch 'collectd-5.7' Conflicts: src/rrdtool.c --- c99e3a4d169ada9299c73e20662d17debdc32e1f diff --cc src/rrdtool.c index 41289058,82f570f4..2dfa87a0 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@@ -606,23 -605,10 +605,10 @@@ static int rrd_cache_flush_identifier(c } /* int rrd_cache_flush_identifier */ static int64_t rrd_get_random_variation(void) { - long min; - long max; - if (random_timeout == 0) - return (0); + return 0; - /* Assure that "cache_timeout + random_variation" is never negative. */ - if (random_timeout > cache_timeout) { - INFO("rrdtool plugin: Adjusting \"RandomTimeout\" to %.3f seconds.", - CDTIME_T_TO_DOUBLE(cache_timeout)); - random_timeout = cache_timeout; - } - - max = (long)(random_timeout / 2); - min = max - ((long)random_timeout); - - return (int64_t)cdrand_range(min, max); + return (int64_t)cdrand_range(-random_timeout, random_timeout); } /* int64_t rrd_get_random_variation */ static int rrd_cache_insert(const char *filename, const char *value, @@@ -883,9 -869,9 +869,9 @@@ static int rrd_config(const char *key, "be greater than 0.\n"); ERROR("rrdtool: `CacheFlush' must " "be greater than 0.\n"); - return (1); + return 1; } - cache_flush_timeout = tmp; + cache_flush_timeout = DOUBLE_TO_CDTIME_T(tmp); } else if (strcasecmp("DataDir", key) == 0) { char *tmp; size_t len;