aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-08-19 21:13:03 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-08-19 21:13:03 +0100
commitbfd6f0dba6a5147e7718c816d064260762d37014 (patch)
tree8f2c23f9824ab294cede5a255cc86c33c7b3ae8a /src/worker.c
parent256a3e0a2967893ba3106fd99f64d16e5b7d21e9 (diff)
downloadrspamd-bfd6f0dba6a5147e7718c816d064260762d37014.tar.gz
rspamd-bfd6f0dba6a5147e7718c816d064260762d37014.zip
[Minor] Add utility function for task timeouts
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/worker.c b/src/worker.c
index 87b63bbdf..26cdc2390 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -186,7 +186,7 @@ rspamd_worker_body_handler (struct rspamd_http_connection *conn,
}
/* Set global timeout for the task */
- if (ctx->task_timeout > 0.0) {
+ if (!isnan(ctx->task_timeout) && ctx->task_timeout > 0.0) {
task->timeout_ev.data = task;
ev_timer_init (&task->timeout_ev, rspamd_task_timeout,
ctx->task_timeout,
@@ -493,14 +493,7 @@ start_worker (struct rspamd_worker *worker)
rspamd_symcache_start_refresh (worker->srv->cfg->cache, ctx->event_loop,
worker);
- if (isnan (ctx->task_timeout)) {
- if (isnan (ctx->cfg->task_timeout)) {
- ctx->task_timeout = 0;
- }
- else {
- ctx->task_timeout = ctx->cfg->task_timeout;
- }
- }
+ ctx->task_timeout = rspamd_worker_check_and_adjust_timeout(ctx->cfg, ctx->task_timeout);
ctx->resolver = rspamd_dns_resolver_init (worker->srv->logger,
ctx->event_loop,