Open xmedeko opened 7 years ago
I have tried to patch MailChimp
class to use just one session and it has lead to about 1/3 speedup on my development machine. I can make a PR to use a session in the MailChimpClient
. However, I think the MailChimp
should not be child of MailChimpClient
. It should use MailChimpClient
as a fields only (inheritance vs. composition). Then it would be possible to switch different implementations of MailChimpClient
.
Nevertheless, most of the use cases may be solved by batch processing.
MailChimpClient
open a new connection for every request. It's faster to reuse the connection pool and keep-alive. So, theMailChimpClient
should open and keep the requests session. Also, if theMailChimpClient
would implement the session, then it should have someclose()
and/or__exit__()
methods to close the session manually.