notifications-admin
notifications-admin copied to clipboard
notify api clients: use a common thread-local `requests.Session`
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.