Don't keep connections for sites that not modified in last week

This commit is contained in:
shortcutme 2018-01-27 12:21:25 +01:00
parent 4afb6b3d9c
commit d44677e46f
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -274,7 +274,10 @@ class FileServer(ConnectionServer):
site.retryBadFiles()
if not startup: # Don't do it at start up because checkSite already has needConnections at start up.
connected_num = site.needConnections(check_site_on_reconnect=True) # Keep active peer connection to get the updates
if time.time() - site.settings.get("modified") < 60 * 60 * 24 * 7:
# Keep active connections if site has been modified witin 7 days
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()])