Redesign Site.needConnections()
This commit is contained in:
parent
3ca323f8b0
commit
511a90a5c5
3 changed files with 80 additions and 26 deletions
|
@ -295,12 +295,12 @@ class FileServer(ConnectionServer):
|
|||
elif site.bad_files:
|
||||
site.retryBadFiles()
|
||||
|
||||
if time.time() - site.settings.get("modified", 0) < 60 * 60 * 24 * 7:
|
||||
# Keep active connections if site has been modified witin 7 days
|
||||
connected_num = site.needConnections(check_site_on_reconnect=True)
|
||||
# Keep active connections
|
||||
connected_num = site.needConnections(check_site_on_reconnect=True)
|
||||
|
||||
if connected_num < config.connected_limit: # This site has small amount of peers, protect them from closing
|
||||
peers_protected.update([peer.key for peer in site.getConnectedPeers()])
|
||||
if connected_num < config.connected_limit:
|
||||
# This site has small amount of peers, protect them from closing
|
||||
peers_protected.update([peer.key for peer in site.getConnectedPeers()])
|
||||
|
||||
time.sleep(1) # Prevent too quick request
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue