This commit is contained in:
Jokob-sk
2023-08-05 12:58:30 +10:00
parent 88ef46b2d4
commit e34a7c032a
2 changed files with 9 additions and 9 deletions

View File

@@ -115,19 +115,21 @@ def main ():
#=============================================================================== #===============================================================================
# This is the main loop of Pi.Alert # This is the main loop of Pi.Alert
#=============================================================================== #===============================================================================
mylog('debug', '[MAIN] Starting loop')
while True: while True:
# update time started # update time started
loop_start_time = timeNow() loop_start_time = timeNow()
mylog('debug', '[MAIN] Starting loop')
# re-load user configuration and plugins # re-load user configuration and plugins
importConfigs(db) importConfigs(db)
# check if new version is available / only check once an hour # check if new version is available / only check once an hour
if last_version_check + datetime.timedelta(hours=1) < loop_start_time :
# if newVersionAvailable is already true the function does nothing and returns true again # if newVersionAvailable is already true the function does nothing and returns true again
mylog('debug', [f"[Version check] Last version check timestamp: {last_version_check}"]) mylog('debug', [f"[Version check] Last version check timestamp: {last_version_check}"])
if last_version_check + datetime.timedelta(hours=1) < loop_start_time :
last_version_check = loop_start_time last_version_check = loop_start_time
conf.newVersionAvailable = isNewVersion(conf.newVersionAvailable) conf.newVersionAvailable = isNewVersion(conf.newVersionAvailable)
@@ -182,8 +184,6 @@ def main ():
run = False run = False
# run once after application starts # run once after application starts
if conf.PHOLUS_RUN == "once" and pholusSchedule.last_run == 0: if conf.PHOLUS_RUN == "once" and pholusSchedule.last_run == 0:
run = True run = True
@@ -228,7 +228,7 @@ def main ():
p = multiprocessing.Process(target=scan_network(db)) p = multiprocessing.Process(target=scan_network(db))
p.start() p.start()
# Wait for 3600 seconds (max 1h) or until process finishes # Wait for a maximum of 3600 seconds (1h) or until process finishes
p.join(3600) p.join(3600)
# If thread is still active # If thread is still active
@@ -300,7 +300,7 @@ def main ():
mylog('verbose', ['[MAIN] waiting to start next loop']) mylog('verbose', ['[MAIN] waiting to start next loop'])
#loop #loop
time.sleep(5) # wait for N seconds time.sleep(1) # wait for N seconds
#=============================================================================== #===============================================================================

View File

@@ -14,7 +14,7 @@ apiEndpoints = []
# API # API
#=============================================================================== #===============================================================================
def update_api(db, isNotification = False, updateOnlyDataSources = []): def update_api(db, isNotification = False, updateOnlyDataSources = []):
mylog('verbose', ['[API] Update API starting']) mylog('debug', ['[API] Update API starting'])
# return # return
folder = apiPath folder = apiPath