aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-16 17:02:16 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-16 17:02:16 +0100
commit0677a1d3ab766ff38bfe367df61dab3a3e54e351 (patch)
tree916fc3f7164da9d042bbfd3b1cea9d7dfe0de8aa /src/libserver
parent7860c27eeb4e01250bda16c07236acbbd349bcb9 (diff)
downloadrspamd-0677a1d3ab766ff38bfe367df61dab3a3e54e351.tar.gz
rspamd-0677a1d3ab766ff38bfe367df61dab3a3e54e351.zip
[Minor] Reduce decay rate and slightly rework rounding
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/rspamd_symcache.c7
1 files 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 */