20 sec timeout for listModified

This commit is contained in:
shortcutme 2017-02-27 00:08:46 +01:00
parent da49981ecd
commit 09ad4133fb
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 7 additions and 5 deletions

View File

@ -289,11 +289,13 @@ class Site(object):
if not peers_try or len(queried) >= 3: # Stop after 3 successful query
break
peer = peers_try.pop(0)
if not peer.connection and len(queried) < 2:
peer.connect() # Only open new connection if less than 2 queried already
if not peer.connection or peer.connection.handshake.get("rev", 0) < 126:
continue # Not compatible
res = peer.listModified(since)
if config.verbose:
self.log.debug("Try to get updates from: %s Left: %s" % (peer, peers_try))
res = None
with gevent.Timeout(20, exception=False):
res = peer.listModified(since)
if not res or "modified_files" not in res:
continue # Failed query