mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
CPU optimizartion work #1144
This commit is contained in:
@@ -20,6 +20,7 @@ import time
|
|||||||
import datetime
|
import datetime
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
# Register NetAlertX modules
|
# Register NetAlertX modules
|
||||||
import conf
|
import conf
|
||||||
@@ -29,7 +30,7 @@ from helper import filePermissions, timeNowTZ, get_setting_value
|
|||||||
from app_state import updateState
|
from app_state import updateState
|
||||||
from api import update_api
|
from api import update_api
|
||||||
from scan.session_events import process_scan
|
from scan.session_events import process_scan
|
||||||
from initialise import importConfigs
|
from initialise import importConfigs, renameSettings
|
||||||
from database import DB
|
from database import DB
|
||||||
from messaging.reporting import get_notifications
|
from messaging.reporting import get_notifications
|
||||||
from models.notification_instance import NotificationInstance
|
from models.notification_instance import NotificationInstance
|
||||||
@@ -44,9 +45,10 @@ from workflows.manager import WorkflowManager
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
"""
|
"""
|
||||||
main structure of Pi Alert
|
main structure of NetAlertX
|
||||||
|
|
||||||
Initialise All
|
Initialise All
|
||||||
|
Rename old settings
|
||||||
start Loop forever
|
start Loop forever
|
||||||
initialise loop
|
initialise loop
|
||||||
(re)import config
|
(re)import config
|
||||||
@@ -92,6 +94,11 @@ def main ():
|
|||||||
|
|
||||||
all_plugins = None
|
all_plugins = None
|
||||||
|
|
||||||
|
# -- SETTINGS BACKWARD COMPATIBILITY START --
|
||||||
|
# rename settings that have changed names due to code cleanup or migration to plugins
|
||||||
|
renameSettings(Path(fullConfPath))
|
||||||
|
# -- SETTINGS BACKWARD COMPATIBILITY END --
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
# re-load user configuration and plugins
|
# re-load user configuration and plugins
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ def importConfigs (db, all_plugins):
|
|||||||
# this avoids time zone issues as we just compare the previous timestamp to the current time stamp
|
# this avoids time zone issues as we just compare the previous timestamp to the current time stamp
|
||||||
|
|
||||||
# rename settings that have changed names due to code cleanup and migration to plugins
|
# rename settings that have changed names due to code cleanup and migration to plugins
|
||||||
renameSettings(config_file)
|
# renameSettings(config_file)
|
||||||
|
|
||||||
fileModifiedTime = os.path.getmtime(config_file)
|
fileModifiedTime = os.path.getmtime(config_file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user