Don't keep connections for sites that not modified in last week
This commit is contained in:
parent
4afb6b3d9c
commit
d44677e46f
1 changed files with 6 additions and 3 deletions
|
@ -274,9 +274,12 @@ class FileServer(ConnectionServer):
|
||||||
site.retryBadFiles()
|
site.retryBadFiles()
|
||||||
|
|
||||||
if not startup: # Don't do it at start up because checkSite already has needConnections at start up.
|
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:
|
||||||
if connected_num < config.connected_limit: # This site has small amount of peers, protect them from closing
|
# Keep active connections if site has been modified witin 7 days
|
||||||
peers_protected.update([peer.key for peer in site.getConnectedPeers()])
|
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()])
|
||||||
|
|
||||||
time.sleep(1) # Prevent too quick request
|
time.sleep(1) # Prevent too quick request
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue