Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
themrphantom committed Nov 12, 2024
1 parent b9b3b6b commit 5075622
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backend/TaskScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@


class TaskScheduler:
def __init__(self) -> None:
def __init__(self,app) -> None:
self.app=app
return

def start(self) -> None:
Expand All @@ -13,7 +14,8 @@ def start(self) -> None:
def loop(self) -> None:
while True:
time.sleep(60*5)
schedule.run_pending()
with self.app.app_context():
schedule.run_pending()

def add_Daily_Task(self, task, *args) -> None:
if len(args) > 0:
Expand Down
2 changes: 1 addition & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
db.convert_usernames_to_lower()
db.add_aliases_if_non_existend()

taskScheduler = TaskScheduler.TaskScheduler()
taskScheduler = TaskScheduler.TaskScheduler(app)
taskScheduler.add_Daily_Task(db.hide_inactive)
if util.pretix_url is not None:
db.enable_disable_pretix_user()
Expand Down

0 comments on commit 5075622

Please sign in to comment.