]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Add extra sleep to avoid race condition
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 13 Jan 2016 00:14:05 +0000 (00:14 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 13 Jan 2016 00:14:05 +0000 (00:14 +0000)
When there are no expressions to compile it is possible that hs_helper
will send notice to no workers. So this sleep should resolve the most of
cases where this race occurs.

src/hs_helper.c

index 260d26674e2716409fd6ce71d97facce6348beb8..c3efb0062ad0cd9ce77fe55402e73d95ae96d455 100644 (file)
@@ -174,6 +174,12 @@ rspamd_rs_compile (struct hs_helper_ctx *ctx, struct rspamd_worker *worker,
        msg_info ("compiled %d regular expressions to the hyperscan tree",
                        ncompiled);
 
+       /*
+        * Do not send notification unless all other workers are started
+        * XXX: now we just sleep for 5 seconds to ensure that
+        */
+       sleep (5);
+
        srv_cmd.type = RSPAMD_SRV_HYPERSCAN_LOADED;
        srv_cmd.cmd.hs_loaded.cache_dir = ctx->hs_dir;