Add optional photo providers, layout studio and scoped integrations
This commit is contained in:
@@ -54,6 +54,7 @@ class Scheduler:
|
||||
self.service, self.db = service, service.db
|
||||
self.stop_event = threading.Event()
|
||||
self.thread = None
|
||||
self.webhook_thread = None
|
||||
self.tick_lock = threading.Lock()
|
||||
|
||||
def jobs(self):
|
||||
@@ -248,6 +249,21 @@ class Scheduler:
|
||||
target=self.run, name="frame-flow-worker", daemon=True
|
||||
)
|
||||
self.thread.start()
|
||||
if hasattr(self.service, "webhooks"):
|
||||
self.webhook_thread = threading.Thread(
|
||||
target=self.run_webhooks, name="frame-flow-webhooks", daemon=True
|
||||
)
|
||||
self.webhook_thread.start()
|
||||
|
||||
def run_webhooks(self):
|
||||
while not self.stop_event.is_set():
|
||||
try:
|
||||
self.service.webhooks.tick()
|
||||
except Exception:
|
||||
logging.getLogger("frame-flow").error(
|
||||
"Webhook cycle failed; details suppressed"
|
||||
)
|
||||
self.stop_event.wait(60)
|
||||
|
||||
def run(self):
|
||||
while not self.stop_event.is_set():
|
||||
@@ -255,6 +271,8 @@ class Scheduler:
|
||||
self.tick()
|
||||
self.service.expire()
|
||||
self.service.cloud_library.sweep()
|
||||
if hasattr(self.service, "local_retention"):
|
||||
self.service.local_retention.sweep()
|
||||
processed = self.service.process_one()
|
||||
self.service.sync()
|
||||
except Exception:
|
||||
@@ -268,6 +286,8 @@ class Scheduler:
|
||||
self.stop_event.set()
|
||||
if self.thread:
|
||||
self.thread.join(timeout=45)
|
||||
if self.webhook_thread:
|
||||
self.webhook_thread.join(timeout=25)
|
||||
|
||||
def healthy(self):
|
||||
return bool(
|
||||
|
||||
Reference in New Issue
Block a user