aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-13 00:14:05 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-13 00:14:05 +0000
commit100f7dc950fa1fefad2d522826a794b6b9297916 (patch)
treeb3820177909c74f6dbf8dfce41f1539bde180ec1 /src
parent72c9856de6f58085df2328557608426acaa36f0b (diff)
downloadrspamd-100f7dc950fa1fefad2d522826a794b6b9297916.tar.gz
rspamd-100f7dc950fa1fefad2d522826a794b6b9297916.zip
Add extra sleep to avoid race condition
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.
Diffstat (limited to 'src')
-rw-r--r--src/hs_helper.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/hs_helper.c b/src/hs_helper.c
index 260d26674..c3efb0062 100644
--- a/src/hs_helper.c
+++ b/src/hs_helper.c
@@ -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;