rumdood / Moneo

Telegram Bot for Managing Scheduled Tasks and Reminders
MIT License
2 stars 0 forks source link

Missing Scheduled Tasks #5

Closed rumdood closed 1 year ago

rumdood commented 1 year ago

Occasionally tasks are not being sent to the chat. E.G. a task to take medication every day at 0900 and 2100 will work fine for several weeks and then suddenly no update reminder will be sent at 0900 one day. Completion of the task is still tracked, but the schedule seems to be turned off.

This can be fixed by submitting an "update" for the task definition, which recreates the schedule for future task events.

rumdood commented 1 year ago

In typical fashion I'm writing this up after spending time already looking into it. The issue occurs within the TaskManager class when a task is completed before the scheduled CheckSend occurs. If the task is completed early, the schedule is not updated because CheckSend returns before executing the scheduling update.

If a repeating task is completed early 2 times in a row, the lack of an updated schedule means that the next time a CheckSend should fire, it won't be scheduled to do so.