Proritize currently requested site update
This commit is contained in:
parent
250741e431
commit
d125551c0d
2 changed files with 7 additions and 1 deletions
|
@ -41,7 +41,6 @@ class Site(object):
|
|||
self.peers = {} # Key: ip:port, Value: Peer.Peer
|
||||
self.peers_recent = collections.deque(maxlen=100)
|
||||
self.peer_blacklist = SiteManager.peer_blacklist # Ignore this peers (eg. myself)
|
||||
self.time_announce = 0 # Last announce time to tracker
|
||||
self.worker_manager = WorkerManager(self) # Handle site download from other peers
|
||||
self.bad_files = {} # SHA check failed files, need to redownload {"inner.content": 1} (key: file, value: failed accept)
|
||||
self.content_updated = None # Content.js update time
|
||||
|
|
|
@ -5,6 +5,8 @@ import mimetypes
|
|||
import json
|
||||
import cgi
|
||||
|
||||
import gevent
|
||||
|
||||
from Config import config
|
||||
from Site import SiteManager
|
||||
from User import UserManager
|
||||
|
@ -307,6 +309,11 @@ class UiRequest(object):
|
|||
return False
|
||||
|
||||
self.sendHeader(extra_headers=extra_headers)
|
||||
|
||||
if time.time() - site.announcer.time_last_announce > 60 * 60:
|
||||
site.log.debug("Site requested, but not announced recently. Updating...")
|
||||
gevent.spawn(site.update, announce=True)
|
||||
|
||||
return iter([self.renderWrapper(site, path, inner_path, title, extra_headers)])
|
||||
# Make response be sent at once (see https://github.com/HelloZeroNet/ZeroNet/issues/1092)
|
||||
|
||||
|
|
Loading…
Reference in a new issue