Ver Fonte

Handle ProtocolError and BadClientError equally

Zed há 3 anos atrás
pai
commit
986b91ac73
1 ficheiros alterados com 2 adições e 5 exclusões
  1. 2 5
      src/http_pool.nim

+ 2 - 5
src/http_pool.nim

@@ -39,11 +39,8 @@ template use*(pool: HttpPool; heads: HttpHeaders; body: untyped): untyped =
 
 
   try:
   try:
     body
     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)
     pool.release(c, true)
     badClient = false
     badClient = false
     c = pool.acquire(heads)
     c = pool.acquire(heads)