From 20115ea505208ac2f1e8b453a35284b871db1321 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Mon, 17 Jul 2017 11:13:53 +0700 Subject: [PATCH] rrdtool plugin: Raise interval of random_variation to match documentation Documentation states what the actual timeout for each value is chosen randomly between - and +. The implementation did not match this. --- src/rrdtool.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/rrdtool.c b/src/rrdtool.c index 2a1a5698..84fcceff 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -605,9 +605,6 @@ static int rrd_cache_flush_identifier(cdtime_t timeout, } /* int rrd_cache_flush_identifier */ static int64_t rrd_get_random_variation(void) { - long min; - long max; - if (random_timeout == 0) return (0); @@ -618,10 +615,7 @@ static int64_t rrd_get_random_variation(void) { 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, -- 2.11.0