From 986b91ac733b36949bd9ac13c78409c4a98f83a0 Mon Sep 17 00:00:00 2001 From: Zed Date: Tue, 29 Aug 2023 23:58:03 +0200 Subject: [PATCH] Handle ProtocolError and BadClientError equally --- src/http_pool.nim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/http_pool.nim b/src/http_pool.nim index b4e3cee..664e9a6 100644 --- a/src/http_pool.nim +++ b/src/http_pool.nim @@ -39,11 +39,8 @@ template use*(pool: HttpPool; heads: HttpHeaders; body: untyped): untyped = try: body - except ProtocolError: - # Twitter closed the connection, retry - body - except BadClientError: - # Twitter returned 503, we need a new client + except BadClientError, ProtocolError: + # Twitter returned 503 or closed the connection, we need a new client pool.release(c, true) badClient = false c = pool.acquire(heads)