diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-08-19 21:13:03 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-08-19 21:13:03 +0100 |
commit | bfd6f0dba6a5147e7718c816d064260762d37014 (patch) | |
tree | 8f2c23f9824ab294cede5a255cc86c33c7b3ae8a /src/controller.c | |
parent | 256a3e0a2967893ba3106fd99f64d16e5b7d21e9 (diff) | |
download | rspamd-bfd6f0dba6a5147e7718c816d064260762d37014.tar.gz rspamd-bfd6f0dba6a5147e7718c816d064260762d37014.zip |
[Minor] Add utility function for task timeouts
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/controller.c b/src/controller.c index 765aa1623..adebce251 100644 --- a/src/controller.c +++ b/src/controller.c @@ -2189,7 +2189,7 @@ rspamd_controller_handle_scan (struct rspamd_http_connection_entry *conn_ent, goto end; } - 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, ctx->task_timeout); @@ -4080,14 +4080,7 @@ start_controller_worker (struct rspamd_worker *worker) rspamd_ftok_icase_equal, rspamd_fstring_mapped_ftok_free, rspamd_plugin_cbdata_dtor); - 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); if (ctx->secure_ip != NULL) { rspamd_config_radix_from_ucl (ctx->cfg, ctx->secure_ip, |