]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Reduce decay rate and slightly rework rounding
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Apr 2021 16:02:16 +0000 (17:02 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 16 Apr 2021 16:02:16 +0000 (17:02 +0100)
src/libserver/rspamd_symcache.c

index 2d2eb142fdec5a20550b47b1a1ab7025de3a22a9..bd8a5bb9107703cfa8ac2504163987a3ab1ce946 100644 (file)
@@ -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 */