aboutsummaryrefslogtreecommitdiffstats
path: root/src/fuzzy_storage.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-07-01 19:56:23 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-07-01 19:56:23 +0100
commit9ffe99ee139743c3ea562d3b7cd999bdab584aa6 (patch)
tree147c06f15bc7f480e44a4e2553e9f7edd8057977 /src/fuzzy_storage.c
parent10212c137481ba7d884d6c606289d70dce567ea1 (diff)
downloadrspamd-9ffe99ee139743c3ea562d3b7cd999bdab584aa6.tar.gz
rspamd-9ffe99ee139743c3ea562d3b7cd999bdab584aa6.zip
[Minor] Try to save ratelimits from the proper worker
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r--src/fuzzy_storage.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 42e0417ac..4bdfabee6 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -3244,9 +3244,6 @@ start_fuzzy (struct rspamd_worker *worker)
rspamd_fuzzy_backend_close (ctx->backend);
if (worker->index == 0) {
- if (ctx->ratelimit_buckets) {
- rspamd_fuzzy_maybe_save_ratelimits (ctx);
- }
g_array_free (ctx->updates_pending, TRUE);
ctx->updates_pending = NULL;
}
@@ -3256,6 +3253,12 @@ start_fuzzy (struct rspamd_worker *worker)
}
if (ctx->ratelimit_buckets) {
+ /* Try the best to save ratelimits from the proper worker */
+ if ((!ctx->dedicated_update_worker && worker->index == 0) ||
+ (ctx->dedicated_update_worker && worker->index == 1)) {
+ rspamd_fuzzy_maybe_save_ratelimits (ctx);
+ }
+
rspamd_lru_hash_destroy (ctx->ratelimit_buckets);
}