summaryrefslogtreecommitdiffstats
path: root/src/fuzzy_storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r--src/fuzzy_storage.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 316e19d0e..d710de172 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -906,10 +906,15 @@ rspamd_fuzzy_check_callback (struct rspamd_fuzzy_reply *result, void *ud)
}
if (!isnan (session->ctx->delay) &&
- rspamd_get_calendar_ticks () - result->ts < session->ctx->delay &&
rspamd_match_radix_map_addr (session->ctx->delay_whitelist,
session->addr) == NULL) {
- send_flags |= RSPAMD_FUZZY_REPLY_DELAY;
+ gdouble hash_age = rspamd_get_calendar_ticks () - result->ts;
+ gdouble jittered_age = rspamd_time_jitter (session->ctx->delay,
+ session->ctx->delay / 2.0);
+
+ if (hash_age < jittered_age) {
+ send_flags |= RSPAMD_FUZZY_REPLY_DELAY;
+ }
}
/* Refresh hash if found with strong confidence */