diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-06 15:17:29 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-06 15:17:29 +0000 |
commit | 0846fb2f60229ae713d9253b80876d9cccf36879 (patch) | |
tree | 6a54c8b201217a8f400356877fe5aa113896538a /src/worker.c | |
parent | e1b043f8bf7970278f55ae7ca1a106dee6c4fa98 (diff) | |
download | rspamd-0846fb2f60229ae713d9253b80876d9cccf36879.tar.gz rspamd-0846fb2f60229ae713d9253b80876d9cccf36879.zip |
[Rework] Unify task_timeout
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/worker.c b/src/worker.c index 9778cee08..81c59a786 100644 --- a/src/worker.c +++ b/src/worker.c @@ -35,14 +35,13 @@ #include "utlist.h" #include "libutil/http_private.h" #include "libmime/lang_detection.h" +#include <math.h> #include "unix-std.h" #include "lua/lua_common.h" /* 60 seconds for worker's IO */ #define DEFAULT_WORKER_IO_TIMEOUT 60000 -/* Timeout for task processing */ -#define DEFAULT_TASK_TIMEOUT 8.0 gpointer init_worker (struct rspamd_config *cfg); void start_worker (struct rspamd_worker *worker); @@ -538,7 +537,7 @@ init_worker (struct rspamd_config *cfg) ctx->is_mime = TRUE; ctx->timeout = DEFAULT_WORKER_IO_TIMEOUT; ctx->cfg = cfg; - ctx->task_timeout = DEFAULT_TASK_TIMEOUT; + ctx->task_timeout = NAN; rspamd_rcl_register_worker_option (cfg, type, @@ -577,9 +576,7 @@ init_worker (struct rspamd_config *cfg) G_STRUCT_OFFSET (struct rspamd_worker_ctx, task_timeout), RSPAMD_CL_FLAG_TIME_FLOAT, - "Maximum task processing time, default: " - G_STRINGIFY(DEFAULT_TASK_TIMEOUT) - " seconds"); + "Maximum task processing time, default: 8.0 seconds"); rspamd_rcl_register_worker_option (cfg, type, @@ -658,6 +655,15 @@ start_worker (struct rspamd_worker *worker) rspamd_symcache_start_refresh (worker->srv->cfg->cache, ctx->ev_base, 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->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg); |