aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-08 17:29:51 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-08 17:31:43 +0100
commit074ef83168a4c06f1a4610e593ce7b45865d8450 (patch)
tree16b3dcf88ed6020a836378c9d364bf51745b76bc /src/libserver
parent9676fd5574bdccc88385d47437c081052adcfde5 (diff)
downloadrspamd-074ef83168a4c06f1a4610e593ce7b45865d8450.tar.gz
rspamd-074ef83168a4c06f1a4610e593ce7b45865d8450.zip
[Minor] Update cached libevent time when possible
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/symbols_cache.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index 8558d62e5..0bd90ec70 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -1303,6 +1303,9 @@ rspamd_symbols_cache_watcher_cb (gpointer sessiond, gpointer ud)
setbit (checkpoint->processed_bits, item->id * 2 + 1);
if (checkpoint->pass > 0) {
+#ifdef HAVE_EVENT_NO_CACHE_TIME_FUNC
+ event_base_update_cache_time (task->ev_base);
+#endif
for (i = 0; i < (gint)checkpoint->waitq->len; i ++) {
it = g_ptr_array_index (checkpoint->waitq, i);
@@ -1382,9 +1385,26 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task,
rspamd_symbols_cache_watcher_cb,
item);
msg_debug_task ("execute %s, %d", item->symbol, item->id);
+#ifdef HAVE_EVENT_NO_CACHE_TIME_FUNC
+ struct timeval tv;
+
+ event_base_update_cache_time (task->ev_base);
+ event_base_gettimeofday_cached (task->ev_base, &tv);
+ t1 = tv_to_double (&tv);
+#else
t1 = rspamd_get_ticks (FALSE);
+#endif
+
item->func (task, item->user_data);
+
+#ifdef HAVE_EVENT_NO_CACHE_TIME_FUNC
+ event_base_update_cache_time (task->ev_base);
+ event_base_gettimeofday_cached (task->ev_base, &tv);
+ t2 = tv_to_double (&tv);
+#else
t2 = rspamd_get_ticks (FALSE);
+#endif
+
diff = (t2 - t1);
if (G_UNLIKELY (RSPAMD_TASK_IS_PROFILING (task))) {