Closed akshetpandey closed 6 months ago
Thank you for your contribution @akshetpandey
@pfouque What do you think? do you have an IMAP server in which to test this pull request?
Hi @Pietro395 : This mitigates a production error we noticed when we had a bug in our code. While processing mails, if user code errors out, the connection will remain open on gmail's side until some timeout (or the socket is gc'ed on our side, which should also send a RST). After a few iterations/parallel workers run into this, gmail will start returning:
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/django_mailbox/transports/imap.py", line 52, in connect
typ, msg = self.server.login(username, password)
File "/layers/google.python.runtime/python/lib/python3.9/imaplib.py", line 612, in login
raise self.error(dat[-1])
imaplib.IMAP4.error: b'[ALERT] Too many simultaneous connections. (Failure)'"
imaplib._MAXLINE
that has been fixed in python3.5 (current min for this library is 3.8)