summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-15 16:41:35 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-15 16:41:35 +0000
commita5eef8b08ca4ea69cc3c5bb718102fe24f20a61b (patch)
tree486a07dba648f1167827915431e28e304576300c
parentb36155bb4b3b911b6d53529dc415d13cff376d2d (diff)
downloadrspamd-a5eef8b08ca4ea69cc3c5bb718102fe24f20a61b.tar.gz
rspamd-a5eef8b08ca4ea69cc3c5bb718102fe24f20a61b.zip
[Fix] Unlock ANN on error
-rw-r--r--src/plugins/lua/fann_redis.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/lua/fann_redis.lua b/src/plugins/lua/fann_redis.lua
index 3652f6724..cff8981de 100644
--- a/src/plugins/lua/fann_redis.lua
+++ b/src/plugins/lua/fann_redis.lua
@@ -400,6 +400,14 @@ local function train_fann(_, ev_base, elt)
if err then
rspamd_logger.errx(rspamd_config, 'cannot save ANN %s to redis: %s',
fann_prefix .. elt, err)
+ redis_make_request(ev_base,
+ rspamd_config,
+ nil,
+ false, -- is write
+ redis_unlock_cb, --callback
+ 'DEL', -- command
+ {fann_prefix .. elt .. '_lock'}
+ )
end
end