aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-20 18:32:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-20 19:43:32 +0100
commitf76b1582238a3ee7f45308f1df4f840c21b946a8 (patch)
treeade86728e44d37eadd73ac588936b88eda6f69a2 /src/libstat/backends
parent251a7c9d11a676a58f22edb8afd09f20c69bd61f (diff)
downloadrspamd-f76b1582238a3ee7f45308f1df4f840c21b946a8.tar.gz
rspamd-f76b1582238a3ee7f45308f1df4f840c21b946a8.zip
[Project] Adopt C modules and stuff
Diffstat (limited to 'src/libstat/backends')
-rw-r--r--src/libstat/backends/redis_backend.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index 74d8c3bf1..113e93df9 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -69,6 +69,7 @@ enum rspamd_redis_connection_state {
struct redis_stat_runtime {
struct redis_stat_ctx *ctx;
struct rspamd_task *task;
+ struct rspamd_symcache_item *item;
struct upstream *selected;
struct event timeout_event;
GArray *results;
@@ -1196,6 +1197,10 @@ rspamd_redis_processed (redisAsyncContext *c, gpointer r, gpointer priv)
}
if (rt->has_event) {
+ if (rt->item) {
+ rspamd_symcache_item_async_dec_check (task, rt->item);
+ }
+
rspamd_session_remove_event (task->s, rspamd_redis_fin, rt);
}
}
@@ -1228,6 +1233,10 @@ rspamd_redis_learned (redisAsyncContext *c, gpointer r, gpointer priv)
}
if (rt->has_event) {
+ if (rt->item) {
+ rspamd_symcache_item_async_dec_check (task, rt->item);
+ }
+
rspamd_session_remove_event (task->s, rspamd_redis_fin_learn, rt);
}
}
@@ -1594,7 +1603,9 @@ rspamd_redis_process_tokens (struct rspamd_task *task,
if (redisAsyncCommand (rt->redis, rspamd_redis_connected, rt, "HGET %s %s",
rt->redis_object_expanded, learned_key) == REDIS_OK) {
- rspamd_session_add_event (task->s, NULL, rspamd_redis_fin, rt, rspamd_redis_stat_quark ());
+ rspamd_session_add_event (task->s,
+ rspamd_redis_fin, rt, rspamd_redis_stat_quark ());
+ rt->item = rspamd_symbols_cache_get_cur_item (task);
rt->has_event = TRUE;
if (rspamd_event_pending (&rt->timeout_event, EV_TIMEOUT)) {
@@ -1798,7 +1809,9 @@ rspamd_redis_learn_tokens (struct rspamd_task *task, GPtrArray *tokens,
"RSIG");
}
- rspamd_session_add_event (task->s, NULL, rspamd_redis_fin_learn, rt, rspamd_redis_stat_quark ());
+ rspamd_session_add_event (task->s,
+ rspamd_redis_fin_learn, rt, rspamd_redis_stat_quark ());
+ rt->item = rspamd_symbols_cache_get_cur_item (task);
rt->has_event = TRUE;
/* Set timeout */