Skip to content

Commit

Permalink
bugfixing scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
joschobart committed Aug 26, 2024
1 parent e24f18e commit b0a49f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fun_with_flags/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def create_app(test_config=None):
# regular job for challenging friendlies
sched.add_job(scheduler.sensor, "cron", day_of_week="thu", hour=8, minute=15)
# regular job for adding matches to user-db
sched.add_job(scheduler.sensor, "cron", day_of_week="tue", hour=1, minute=25)
sched.add_job(scheduler.sensor, "cron", day_of_week="tue", hour=1, minute=35)
# v--- testing ---v
# sched.add_job(scheduler.sensor, "cron", day_of_week="mon-sun", hour=21, minute=40)
sched.start()
Expand Down
20 changes: 11 additions & 9 deletions fun_with_flags/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@ def sensor():
"team_country_id"
]

_my_doc = db.set_match_history(
_user_id,
_user_couch,
_country_id,
_match_id,
_match_place,
_team_id,
)
try:
_my_doc = db.set_match_history(
_user_id,
_user_couch,
_country_id,
_match_id,
_match_place,
_team_id,
)
except KeyError:
continue

# Write changements on the history-object to db
_user_couch[_user_id] = _my_doc
Expand Down Expand Up @@ -156,7 +159,6 @@ def sensor():
schedule(_object, "tuesday")

else:
_my_document[_team_id]["fernet_token"] = ""
continue

# Finally delete fernet-token from DB
Expand Down

0 comments on commit b0a49f7

Please sign in to comment.