Skip to content
Snippets Groups Projects
Commit fa35b126 authored by inso's avatar inso
Browse files

Let's try to catch all RequestException at first

parent dad87068
No related branches found
No related tags found
No related merge requests found
...@@ -270,11 +270,12 @@ class Community(object): ...@@ -270,11 +270,12 @@ class Community(object):
continue continue
else: else:
raise raise
except Timeout: except RequestException:
# Move the timeout peer to the end # Move the timeout peer to the end
self.peers.remove(peer) self.peers.remove(peer)
self.peers.append(peer) self.peers.append(peer)
continue continue
raise NoPeerAvailable(self.currency, len(self.peers)) raise NoPeerAvailable(self.currency, len(self.peers))
def post(self, request, req_args={}, post_args={}): def post(self, request, req_args={}, post_args={}):
...@@ -287,7 +288,7 @@ class Community(object): ...@@ -287,7 +288,7 @@ class Community(object):
return return
except ValueError as e: except ValueError as e:
raise raise
except Timeout: except RequestException:
# Move the timeout peer to the end # Move the timeout peer to the end
self.peers.remove(peer) self.peers.remove(peer)
self.peers.append(peer) self.peers.append(peer)
...@@ -310,7 +311,7 @@ class Community(object): ...@@ -310,7 +311,7 @@ class Community(object):
except ValueError as e: except ValueError as e:
value_error = e value_error = e
continue continue
except Timeout: except RequestException:
tries = tries + 1 tries = tries + 1
# Move the timeout peer to the end # Move the timeout peer to the end
self.peers.remove(peer) self.peers.remove(peer)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment