ODNZSL / nzsl-dictionary-scripts

Scripts needed to support the NZSL mobile applications
MIT License
3 stars 2 forks source link

fix: retry S3 gets when a protocol error occurs before giving up entirely #18

Closed G-Rath closed 10 months ago

G-Rath commented 10 months ago

Per the code comment: requests ~(or apparently maybe urllib3)~ only retries when a valid HTTP response has a particular status code, but it doesn't handle if the actual connection is broken - specifically we're getting "incomplete reads" from time to time.

Since I don't have a good way of actively testing this, I've started with just a straight forward "lets retry once" which will hopefully be enough to smooth out the failures; I've also done this by refactoring the existing s3_session method since it was only being used in one place anyway so it doesn't feel worth adding a whole other wrapper method

Also see https://github.com/psf/requests/issues/4568