Prevent Pronote watchdog startup crashes

This commit is contained in:
root 2026-08-14 17:22:02 +00:00
parent 75f97938b9
commit f6c62d2f78

View file

@ -80,7 +80,7 @@ def sync_pronote_plannings():
app = create_app()
with app.app_context():
gmao_context = GmaoContext.get_for_user(2) # TODO: rendre configurable
gmao_context = GmaoContext.query.filter_by(pronote_sync_enabled=True).first()
weeks = gmao_context.pronote_sync_weeks if gmao_context else 4
# Récupérer le client PRONOTE
@ -210,7 +210,7 @@ def run_watchdog():
app = create_app()
with app.app_context():
# Récupérer le contexte GMAO
gmao_context = GmaoContext.get_for_user(2) # TODO: rendre configurable
gmao_context = GmaoContext.query.filter_by(pronote_sync_enabled=True).first()
# Vérifier si activé
if not gmao_context or not gmao_context.pronote_sync_enabled:
@ -270,6 +270,7 @@ def main():
signal.signal(signal.SIGINT, signal_handler)
while running:
result = None
try:
result = run_watchdog()
if result is False: