Prevent Pronote watchdog startup crashes
This commit is contained in:
parent
75f97938b9
commit
f6c62d2f78
1 changed files with 4 additions and 3 deletions
|
|
@ -80,7 +80,7 @@ def sync_pronote_plannings():
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
with app.app_context():
|
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
|
weeks = gmao_context.pronote_sync_weeks if gmao_context else 4
|
||||||
|
|
||||||
# Récupérer le client PRONOTE
|
# Récupérer le client PRONOTE
|
||||||
|
|
@ -210,7 +210,7 @@ def run_watchdog():
|
||||||
app = create_app()
|
app = create_app()
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
# Récupérer le contexte GMAO
|
# 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é
|
# Vérifier si activé
|
||||||
if not gmao_context or not gmao_context.pronote_sync_enabled:
|
if not gmao_context or not gmao_context.pronote_sync_enabled:
|
||||||
|
|
@ -270,6 +270,7 @@ def main():
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
while running:
|
while running:
|
||||||
|
result = None
|
||||||
try:
|
try:
|
||||||
result = run_watchdog()
|
result = run_watchdog()
|
||||||
if result is False:
|
if result is False:
|
||||||
|
|
@ -292,4 +293,4 @@ def main():
|
||||||
log("Watchdog PRONOTE arrêté")
|
log("Watchdog PRONOTE arrêté")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue