commit 0677a1d: [Minor] Reduce decay rate and slightly rework rounding
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Apr 16 16:07:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-04-16 17:02:16 +0100
URL: https://github.com/rspamd/rspamd/commit/0677a1d3ab766ff38bfe367df61dab3a3e54e351 (HEAD -> master)
[Minor] Reduce decay rate and slightly rework rounding
---
src/libserver/rspamd_symcache.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c
index 2d2eb142f..bd8a5bb91 100644
--- a/src/libserver/rspamd_symcache.c
+++ b/src/libserver/rspamd_symcache.c
@@ -2345,7 +2345,10 @@ struct counters_cbdata {
struct rspamd_symcache *cache;
};
-#define ROUND_DOUBLE(x) (floor((x) * 100.0) / 100.0)
+/* Leave several digits */
+#define P10(X) (1e##X)
+#define ROUND_DOUBLE_DIGITS(x, dig) (floor((x) * P10(dig)) / P10(dig))
+#define ROUND_DOUBLE(x) ROUND_DOUBLE_DIGITS(x, 3)
static void
rspamd_symcache_counters_cb (gpointer k, gpointer v, gpointer ud)
@@ -2466,7 +2469,7 @@ rspamd_symcache_resort_cb (EV_P_ ev_timer *w, int revents)
struct rspamd_symcache_item *item;
guint i;
gdouble cur_ticks;
- static const double decay_rate = 0.7;
+ static const double decay_rate = 0.25;
cache = cbdata->cache;
/* Plan new event */
More information about the Commits
mailing list