Fixed missing timestamp update on page/file periodic scan

This commit is contained in:
Mark Qvist 2024-01-08 00:10:55 +01:00
parent 5736012f2c
commit 1f7302903a
3 changed files with 25 additions and 3 deletions

View File

@ -50,6 +50,8 @@ class Node:
def register_pages(self): def register_pages(self):
# TODO: Deregister previously registered pages
# that no longer exist.
self.servedpages = [] self.servedpages = []
self.scan_pages(self.app.pagespath) self.scan_pages(self.app.pagespath)
@ -69,6 +71,8 @@ class Node:
) )
def register_files(self): def register_files(self):
# TODO: Deregister previously registered files
# that no longer exist.
self.servedfiles = [] self.servedfiles = []
self.scan_files(self.app.filespath) self.scan_files(self.app.filespath)
@ -230,10 +234,12 @@ class Node:
if self.page_refresh_interval > 0: if self.page_refresh_interval > 0:
if now > self.last_page_refresh + self.page_refresh_interval*60: if now > self.last_page_refresh + self.page_refresh_interval*60:
self.register_pages() self.register_pages()
self.last_page_refresh = time.time()
if self.file_refresh_interval > 0: if self.file_refresh_interval > 0:
if now > self.last_file_refresh + self.file_refresh_interval*60: if now > self.last_file_refresh + self.file_refresh_interval*60:
self.register_files() self.register_files()
self.last_file_refresh = time.time()
time.sleep(self.job_interval) time.sleep(self.job_interval)

View File

@ -1077,6 +1077,22 @@ announce_at_start = Yes
# and generally you do not need to use it. # and generally you do not need to use it.
# prioritise_destinations = 41d20c727598a3fbbdf9106133a3a0ed, d924b81822ca24e68e2effea99bcb8cf # prioritise_destinations = 41d20c727598a3fbbdf9106133a3a0ed, d924b81822ca24e68e2effea99bcb8cf
# Automatic rescan interval of the pages directory in minutes.
# Default: int = 0 (no rescan)
page_refresh_interval = 0
# You can specify the interval in minutes for
# rescanning the hosted pages path. By default,
# this option is disabled, and the pages path
# will only be scanned on startup.
# page_refresh_interval = 0
# You can specify the interval in minutes for
# rescanning the hosted files path. By default,
# this option is disabled, and the files path
# will only be scanned on startup.
# file_refresh_interval = 0
[printing] [printing]
# You can configure Nomad Network to print # You can configure Nomad Network to print

View File

@ -624,7 +624,7 @@ Determines where the node server will look for hosted pages. Must be a readable
>>> >>>
`!page_refresh_interval = 0`! `!page_refresh_interval = 0`!
>>>> >>>>
Determines the interval in seconds for rescanning the hosted pages path. By default, this option is disabled, and the pages path will only be scanned on startup. Determines the interval in minutes for rescanning the hosted pages path. By default, this option is disabled, and the pages path will only be scanned on startup.
< <
>>> >>>
@ -636,7 +636,7 @@ Determines where the node server will look for downloadable files. Must be a rea
>>> >>>
`!file_refresh_interval = 0`! `!file_refresh_interval = 0`!
>>>> >>>>
Determines the interval in seconds for rescanning the hosted files path. By default, this option is disabled, and the files path will only be scanned on startup. Determines the interval in minutes for rescanning the hosted files path. By default, this option is disabled, and the files path will only be scanned on startup.
< <
>>> >>>