mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Add update check to 12hr schedule
Co-authored-by: andrew.charles.mcmanus@gmail.com <andrew.charles.mcmanus@gmail.com>
This commit is contained in:
parent
d258c4ec0c
commit
ff0faffc08
@ -76,6 +76,7 @@ class Helpers:
|
|||||||
|
|
||||||
self.websocket_helper = WebSocketHelper(self)
|
self.websocket_helper = WebSocketHelper(self)
|
||||||
self.translation = Translation(self)
|
self.translation = Translation(self)
|
||||||
|
self.update_available = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def auto_installer_fix(ex):
|
def auto_installer_fix(ex):
|
||||||
|
@ -3,7 +3,7 @@ import time
|
|||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from tzlocal import get_localzone
|
from tzlocal import get_localzone
|
||||||
from tzlocal.utils import ZoneInfoNotFoundError
|
from tzlocal.utils import ZoneInfoNotFoundError
|
||||||
@ -193,6 +193,14 @@ class TasksManager:
|
|||||||
schedules = HelpersManagement.get_schedules_enabled()
|
schedules = HelpersManagement.get_schedules_enabled()
|
||||||
self.scheduler.add_listener(self.schedule_watcher, mask=EVENT_JOB_EXECUTED)
|
self.scheduler.add_listener(self.schedule_watcher, mask=EVENT_JOB_EXECUTED)
|
||||||
self.scheduler.start()
|
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.add_job(
|
||||||
# self.scheduler.print_jobs, "interval", seconds=10, id="-1"
|
# self.scheduler.print_jobs, "interval", seconds=10, id="-1"
|
||||||
# )
|
# )
|
||||||
@ -646,6 +654,10 @@ class TasksManager:
|
|||||||
)
|
)
|
||||||
time.sleep(1)
|
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):
|
def log_watcher(self):
|
||||||
self.controller.servers.check_for_old_logs()
|
self.controller.servers.check_for_old_logs()
|
||||||
self.scheduler.add_job(
|
self.scheduler.add_job(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user