Add update check to 12hr schedule

Co-authored-by: andrew.charles.mcmanus@gmail.com <andrew.charles.mcmanus@gmail.com>
This commit is contained in:
Zedifus 2022-08-05 02:37:21 +01:00
parent d258c4ec0c
commit ff0faffc08
2 changed files with 14 additions and 1 deletions

View File

@ -76,6 +76,7 @@ class Helpers:
self.websocket_helper = WebSocketHelper(self)
self.translation = Translation(self)
self.update_available = False
@staticmethod
def auto_installer_fix(ex):

View File

@ -3,7 +3,7 @@ import time
import logging
import threading
import asyncio
import datetime
from datetime import datetime
from tzlocal import get_localzone
from tzlocal.utils import ZoneInfoNotFoundError
@ -193,6 +193,14 @@ class TasksManager:
schedules = HelpersManagement.get_schedules_enabled()
self.scheduler.add_listener(self.schedule_watcher, mask=EVENT_JOB_EXECUTED)
self.scheduler.start()
self.check_for_updates()
self.scheduler.add_job(
self.check_for_updates,
"interval",
hours=12,
id="update_watcher",
start_date=datetime.now(),
)
# self.scheduler.add_job(
# self.scheduler.print_jobs, "interval", seconds=10, id="-1"
# )
@ -646,6 +654,10 @@ class TasksManager:
)
time.sleep(1)
def check_for_updates(self):
self.helper.update_available = self.helper.check_remote_version()
print(self.helper.update_available)
def log_watcher(self):
self.controller.servers.check_for_old_logs()
self.scheduler.add_job(