mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 21:27:14 -05:00
strip out buggy retry code
it assumed there'd be at least one retry, and was trying to return response that was initialized
This commit is contained in:
parent
be81d282ac
commit
3dbc6fa0dd
1 changed files with 46 additions and 63 deletions
17
aqt/sync.py
17
aqt/sync.py
|
|
@ -449,7 +449,6 @@ httplib.HTTPConnection.send = _incrementalSend
|
||||||
|
|
||||||
# receiving in httplib2
|
# receiving in httplib2
|
||||||
def _conn_request(self, conn, request_uri, method, body, headers):
|
def _conn_request(self, conn, request_uri, method, body, headers):
|
||||||
for i in range(httplib2.RETRIES):
|
|
||||||
try:
|
try:
|
||||||
if conn.sock is None:
|
if conn.sock is None:
|
||||||
conn.connect()
|
conn.connect()
|
||||||
|
|
@ -475,26 +474,11 @@ def _conn_request(self, conn, request_uri, method, body, headers):
|
||||||
# Just because the server closed the connection doesn't apparently mean
|
# Just because the server closed the connection doesn't apparently mean
|
||||||
# that the server didn't send a response.
|
# that the server didn't send a response.
|
||||||
if conn.sock is None:
|
if conn.sock is None:
|
||||||
if i == 0:
|
|
||||||
conn.close()
|
|
||||||
conn.connect()
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
conn.close()
|
conn.close()
|
||||||
raise
|
raise
|
||||||
if i == 0:
|
|
||||||
conn.close()
|
|
||||||
conn.connect()
|
|
||||||
continue
|
|
||||||
pass
|
|
||||||
try:
|
try:
|
||||||
response = conn.getresponse()
|
response = conn.getresponse()
|
||||||
except (socket.error, httplib.HTTPException):
|
except (socket.error, httplib.HTTPException):
|
||||||
if i == 0:
|
|
||||||
conn.close()
|
|
||||||
conn.connect()
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
content = ""
|
content = ""
|
||||||
|
|
@ -512,7 +496,6 @@ def _conn_request(self, conn, request_uri, method, body, headers):
|
||||||
response = httplib2.Response(response)
|
response = httplib2.Response(response)
|
||||||
if method != "HEAD":
|
if method != "HEAD":
|
||||||
content = httplib2._decompressContent(response, content)
|
content = httplib2._decompressContent(response, content)
|
||||||
break
|
|
||||||
return (response, content)
|
return (response, content)
|
||||||
|
|
||||||
httplib2.Http._conn_request = _conn_request
|
httplib2.Http._conn_request = _conn_request
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue