From 4d1abf97dd0d909b17d1cefa57f03a129cbe5735 Mon Sep 17 00:00:00 2001 From: Uxio Fuentefria Date: Tue, 11 Jan 2022 14:14:17 +0100 Subject: [PATCH] Increase connection pool for webhook HTTP requests - Updated from 10 -> 100 concurrent connections - Related to #620 --- safe_transaction_service/history/tasks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/safe_transaction_service/history/tasks.py b/safe_transaction_service/history/tasks.py index c8685001f..e2637f306 100644 --- a/safe_transaction_service/history/tasks.py +++ b/safe_transaction_service/history/tasks.py @@ -355,7 +355,15 @@ def check_reorgs_task(self) -> Optional[int]: @cache def get_webhook_http_session(webhook_url: str) -> requests.Session: logger.debug("Getting http session for url=%s", webhook_url) - return requests.Session() + session = requests.Session() + adapter = requests.adapters.HTTPAdapter( + pool_connections=1, # Doing all the connections to the same url + pool_maxsize=100, # Number of concurrent connections + pool_block=False, + ) + session.mount("http://", adapter) + session.mount("https://", adapter) + return session @app.shared_task(