From: Vsevolod Stakhov Date: Wed, 13 Jan 2016 00:14:05 +0000 (+0000) Subject: Add extra sleep to avoid race condition X-Git-Tag: 1.1.0~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=100f7dc950fa1fefad2d522826a794b6b9297916;p=thirdparty%2Frspamd.git 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. --- diff --git a/src/hs_helper.c b/src/hs_helper.c index 260d26674e..c3efb0062a 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;