commit b70711c: [Minor] Slightly increase write timeout

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Jan 28 14:42:07 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-01-28 14:38:51 +0000
URL: https://github.com/rspamd/rspamd/commit/b70711c9e1be8c2387ba468dedb5776a8184ee9d (HEAD -> master)

[Minor] Slightly increase write timeout

---
 src/libserver/task.c | 2 +-
 src/rspamd_proxy.c   | 2 +-
 src/worker.c         | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/libserver/task.c b/src/libserver/task.c
index 096933803..43ce59ee1 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -125,7 +125,7 @@ rspamd_task_new (struct rspamd_worker *worker,
 static void
 rspamd_task_reply (struct rspamd_task *task)
 {
-	const ev_tstamp write_timeout = 2.0;
+	const ev_tstamp write_timeout = 5.0;
 
 	if (task->fin_callback) {
 		task->fin_callback (task, task->fin_arg);
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 3fa5da390..f5bc5f68e 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -1737,7 +1737,7 @@ rspamd_proxy_scan_self_reply (struct rspamd_task *task)
 				NULL,
 				ctype,
 				session,
-				0);
+				session->ctx->timeout / 10.0);
 	}
 }
 
diff --git a/src/worker.c b/src/worker.c
index 1a3b118c8..5262f7cde 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -271,12 +271,13 @@ rspamd_worker_error_handler (struct rspamd_http_connection *conn, GError *err)
 			rspamd_printf_fstring (&reply, "{\"error\":\"%V\"}", msg->status);
 			rspamd_http_message_set_body_from_fstring_steal (msg, reply);
 			rspamd_http_connection_reset (task->http_conn);
+			/* Use a shorter timeout for writing reply */
 			rspamd_http_connection_write_message (task->http_conn,
 					msg,
 					NULL,
 					"application/json",
 					task,
-					1.0);
+					session->ctx->timeout / 10.0);
 		}
 	}
 	else {


More information about the Commits mailing list