notifications-admin icon indicating copy to clipboard operation
notifications-admin copied to clipboard

notify api clients: use a common thread-local `requests.Session`

Open risicle opened this issue 9 months ago • 0 comments

Depends on https://github.com/alphagov/notifications-python-client/pull/255

We're currently dividing the effectiveness of any connection-pooling we're doing to api-web by >20x by having a separate connection pool per sub-api-client. This contributes to the excessive number of GreenThreads api-web needs to keep active when it has keepalive enabled.

Instead keep a single (lazily-constructed) requests.Session per-thread which gets injected into each sub-api-client at lazy-construction-time.

risicle avatar Mar 02 '25 16:03 risicle