mirror of
https://github.com/markqvist/NomadNet.git
synced 2024-12-26 23:59:26 -05:00
Added file and path scans to jobs
This commit is contained in:
parent
e022d469f8
commit
2449b39f77
@ -15,7 +15,11 @@ class Node:
|
|||||||
self.identity = self.app.identity
|
self.identity = self.app.identity
|
||||||
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, "nomadnetwork", "node")
|
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, "nomadnetwork", "node")
|
||||||
self.last_announce = time.time()
|
self.last_announce = time.time()
|
||||||
|
self.last_file_refresh = time.time()
|
||||||
|
self.last_page_refresh = time.time()
|
||||||
self.announce_interval = self.app.node_announce_interval
|
self.announce_interval = self.app.node_announce_interval
|
||||||
|
self.page_refresh_interval = self.app.page_refresh_interval
|
||||||
|
self.file_refresh_interval = self.app.file_refresh_interval
|
||||||
self.job_interval = Node.JOB_INTERVAL
|
self.job_interval = Node.JOB_INTERVAL
|
||||||
self.should_run_jobs = True
|
self.should_run_jobs = True
|
||||||
self.app_data = None
|
self.app_data = None
|
||||||
@ -223,6 +227,14 @@ class Node:
|
|||||||
if now > self.last_announce + self.announce_interval*60:
|
if now > self.last_announce + self.announce_interval*60:
|
||||||
self.announce()
|
self.announce()
|
||||||
|
|
||||||
|
if self.page_refresh_interval > 0:
|
||||||
|
if now > self.last_page_refresh + self.page_refresh_interval*60:
|
||||||
|
self.register_pages()
|
||||||
|
|
||||||
|
if self.file_refresh_interval > 0:
|
||||||
|
if now > self.last_file_refresh + self.file_refresh_interval*60:
|
||||||
|
self.register_files()
|
||||||
|
|
||||||
time.sleep(self.job_interval)
|
time.sleep(self.job_interval)
|
||||||
|
|
||||||
def peer_connected(self, link):
|
def peer_connected(self, link):
|
||||||
|
@ -119,6 +119,8 @@ class NomadNetworkApp:
|
|||||||
self.should_run_jobs = True
|
self.should_run_jobs = True
|
||||||
self.job_interval = 5
|
self.job_interval = 5
|
||||||
self.defer_jobs = 90
|
self.defer_jobs = 90
|
||||||
|
self.page_refresh_interval = 0
|
||||||
|
self.file_refresh_interval = 0
|
||||||
|
|
||||||
self.peer_announce_at_start = True
|
self.peer_announce_at_start = True
|
||||||
self.try_propagation_on_fail = True
|
self.try_propagation_on_fail = True
|
||||||
@ -831,9 +833,27 @@ class NomadNetworkApp:
|
|||||||
if "pages_path" in self.config["node"]:
|
if "pages_path" in self.config["node"]:
|
||||||
self.pagespath = self.config["node"]["pages_path"]
|
self.pagespath = self.config["node"]["pages_path"]
|
||||||
|
|
||||||
|
if not "page_refresh_interval" in self.config["node"]:
|
||||||
|
self.page_refresh_interval = 0
|
||||||
|
else:
|
||||||
|
value = self.config["node"].as_int("page_refresh_interval")
|
||||||
|
if value < 0:
|
||||||
|
value = 0
|
||||||
|
self.page_refresh_interval = value
|
||||||
|
|
||||||
|
|
||||||
if "files_path" in self.config["node"]:
|
if "files_path" in self.config["node"]:
|
||||||
self.filespath = self.config["node"]["files_path"]
|
self.filespath = self.config["node"]["files_path"]
|
||||||
|
|
||||||
|
if not "file_refresh_interval" in self.config["node"]:
|
||||||
|
self.file_refresh_interval = 0
|
||||||
|
else:
|
||||||
|
value = self.config["node"].as_int("file_refresh_interval")
|
||||||
|
if value < 0:
|
||||||
|
value = 0
|
||||||
|
self.file_refresh_interval = value
|
||||||
|
|
||||||
|
|
||||||
if "prioritise_destinations" in self.config["node"]:
|
if "prioritise_destinations" in self.config["node"]:
|
||||||
self.prioritised_lxmf_destinations = self.config["node"].as_list("prioritise_destinations")
|
self.prioritised_lxmf_destinations = self.config["node"].as_list("prioritise_destinations")
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user