forked from LeineLab-Public/lab-signal-bot
LabCleaningBot: check for timeouts
This commit is contained in:
parent
509e133913
commit
c4725e2685
8
main.py
8
main.py
@ -334,6 +334,14 @@ class LabCleaningBot:
|
||||
else:
|
||||
print(res.unwrap_err())
|
||||
|
||||
# check for timeouts
|
||||
for request in task.freshly_expired_requests(datetime.datetime.now()):
|
||||
print("Request expired:", repr(request))
|
||||
message = SendMessageSimple(
|
||||
message="You did not respond to the task request in time.",
|
||||
recipients=[request.user.name])
|
||||
res = self.api.send_message(message)
|
||||
|
||||
session.commit()
|
||||
|
||||
await asyncio.sleep(1)
|
||||
|
@ -113,6 +113,8 @@ class Task(SQLModel, table=True):
|
||||
if maybe_timeout is not None:
|
||||
expired_requests.append(r)
|
||||
|
||||
return expired_requests
|
||||
|
||||
def create_additional_requests(self, now: datetime.datetime, session: Session) -> Result[List["ParticipationRequest"], List["ParticipationRequest"]]:
|
||||
additional_requests = []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user