Handle ProtocolError and BadClientError equally

This commit is contained in:
Zed 2023-08-29 23:58:03 +02:00
parent 4ccf350dc7
commit 986b91ac73
1 changed files with 2 additions and 5 deletions

View File

@ -39,11 +39,8 @@ template use*(pool: HttpPool; heads: HttpHeaders; body: untyped): untyped =
try: try:
body body
except ProtocolError: except BadClientError, ProtocolError:
# Twitter closed the connection, retry # Twitter returned 503 or closed the connection, we need a new client
body
except BadClientError:
# Twitter returned 503, we need a new client
pool.release(c, true) pool.release(c, true)
badClient = false badClient = false
c = pool.acquire(heads) c = pool.acquire(heads)