LabCleaningBot: add unfulfillable_tasks to sync_members_and_tasks()

This commit is contained in:
lemoer 2024-12-27 01:24:56 +01:00
parent 00d16561d5
commit d7b22f3bc5

15
main.py
View File

@ -231,6 +231,8 @@ class LabCleaningBot:
print("Websockets connection closed. Reestablishing connection.") print("Websockets connection closed. Reestablishing connection.")
async def sync_members_and_tasks(self, session: Session): async def sync_members_and_tasks(self, session: Session):
unfulfillable_tasks = []
while True: while True:
sync_result = self.sync_members_as_active_users(session) sync_result = self.sync_members_as_active_users(session)
@ -243,12 +245,15 @@ class LabCleaningBot:
reqs = task.create_additional_requests(utc_now(), session) reqs = task.create_additional_requests(utc_now(), session)
if is_err(reqs): if is_err(reqs):
res = self.send_to_base_group("Could not fulfill task: " + task.name) if task not in unfulfillable_tasks:
res = self.send_to_base_group("Could not fulfill task: " + task.name)
if is_err(res): unfulfillable_tasks.append(task)
print(res.unwrap_err())
else: if is_err(res):
print(res.unwrap()) print(res.unwrap_err())
else:
print(res.unwrap())
reqs = reqs.unwrap_err() reqs = reqs.unwrap_err()
else: else: