From e34a7c032a4527aee64b5b2aff7001882cd70f3b Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sat, 5 Aug 2023 12:58:30 +1000 Subject: [PATCH] #303 work --- pialert/__main__.py | 16 ++++++++-------- pialert/api.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pialert/__main__.py b/pialert/__main__.py index 102ca59e..e9edc815 100755 --- a/pialert/__main__.py +++ b/pialert/__main__.py @@ -115,19 +115,21 @@ def main (): #=============================================================================== # This is the main loop of Pi.Alert #=============================================================================== + + mylog('debug', '[MAIN] Starting loop') + while True: # update time started loop_start_time = timeNow() - mylog('debug', '[MAIN] Starting loop') - + # re-load user configuration and plugins importConfigs(db) # check if new version is available / only check once an hour - # 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}"]) if last_version_check + datetime.timedelta(hours=1) < loop_start_time : + # 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}"]) last_version_check = loop_start_time conf.newVersionAvailable = isNewVersion(conf.newVersionAvailable) @@ -182,8 +184,6 @@ def main (): run = False # run once after application starts - - if conf.PHOLUS_RUN == "once" and pholusSchedule.last_run == 0: run = True @@ -228,7 +228,7 @@ def main (): p = multiprocessing.Process(target=scan_network(db)) 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) # If thread is still active @@ -300,7 +300,7 @@ def main (): mylog('verbose', ['[MAIN] waiting to start next loop']) #loop - time.sleep(5) # wait for N seconds + time.sleep(1) # wait for N seconds #=============================================================================== diff --git a/pialert/api.py b/pialert/api.py index 91549bf7..40d902b5 100755 --- a/pialert/api.py +++ b/pialert/api.py @@ -14,7 +14,7 @@ apiEndpoints = [] # API #=============================================================================== def update_api(db, isNotification = False, updateOnlyDataSources = []): - mylog('verbose', ['[API] Update API starting']) + mylog('debug', ['[API] Update API starting']) # return folder = apiPath