update
This commit is contained in:
@@ -10,6 +10,7 @@ from fastapi.middleware.gzip import GZipMiddleware
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from . import (
|
||||
backup,
|
||||
db,
|
||||
events,
|
||||
features,
|
||||
@@ -69,6 +70,11 @@ app.add_middleware(
|
||||
)
|
||||
|
||||
|
||||
async def sicherung():
|
||||
# Die Kopie blockiert kurz — nicht im Ereignisschleifen-Thread
|
||||
await asyncio.to_thread(backup.sichern)
|
||||
|
||||
|
||||
async def guarded_sync():
|
||||
if sync_lock.locked():
|
||||
log.info("Sync läuft bereits")
|
||||
@@ -85,6 +91,9 @@ async def startup():
|
||||
watched.init()
|
||||
wishlist.init()
|
||||
features.init()
|
||||
# Erst die Sicherung, dann der Sync — so liegt vor jedem Katalog-Update
|
||||
# ein sauberer Stand
|
||||
scheduler.add_job(sicherung, "cron", hour=4, minute=0, id="daily-backup")
|
||||
scheduler.add_job(guarded_sync, "cron", hour=4, minute=30, id="daily-sync")
|
||||
scheduler.start()
|
||||
if not db.get_meta("last_sync"):
|
||||
|
||||
Reference in New Issue
Block a user