summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c7cbb2a)
raw | patch | inline | side by side (parent: c7cbb2a)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 17 Jul 2017 04:13:53 +0000 (11:13 +0700) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 20 Jul 2017 05:54:35 +0000 (07:54 +0200) |
Documentation states what the actual timeout for each value is chosen randomly
between <CacheTimeout>-<RandomTimeout> and <CacheTimeout>+<RandomTimeout>.
The implementation did not match this.
between <CacheTimeout>-<RandomTimeout> and <CacheTimeout>+<RandomTimeout>.
The implementation did not match this.
src/rrdtool.c | patch | blob | history |
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 2a1a569888bd2fc6b100b2dd9e392d6356533d21..84fcceff9d76d3217ad0dbc110a8ca6ec9ee9953 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
} /* int rrd_cache_flush_identifier */
static int64_t rrd_get_random_variation(void) {
- long min;
- long max;
-
if (random_timeout == 0)
return (0);
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,