Skip to content

Commit

Permalink
Increase connection pool for webhook HTTP requests
Browse files Browse the repository at this point in the history
- Updated from 10 -> 100 concurrent connections
- Related to safe-global#620
  • Loading branch information
Uxio0 committed Jan 11, 2022
1 parent 5308226 commit 4d1abf9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion safe_transaction_service/history/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4d1abf9

Please sign in to comment.