diff --git a/main.py b/main.py index 656258f..fa6de92 100644 --- a/main.py +++ b/main.py @@ -426,7 +426,8 @@ You have time to answer for {format_seconds(task.timeout)}.""" else: print(res.unwrap_err()) - # check for timeouts + # Check for timeouts (for all tasks, also those that are timeouted) + for task in get_tasks(session): for request in task.freshly_expired_requests(now()): print("Request expired:", repr(request)) message = SendMessageSimple( diff --git a/models.py b/models.py index 9020d1f..59ad7fc 100644 --- a/models.py +++ b/models.py @@ -137,6 +137,9 @@ class Task(SQLModel, table=True): def get_active_tasks(session: Session, now: datetime.datetime) -> List[Task]: return session.exec(select(Task).where(Task.due > now)).all() +def get_tasks(session: Session) -> List[Task]: + return session.exec(select(Task)).all() + class ParticipationState(enum.Enum): REQUESTED = "requested" ACCEPTED = "accepted"