Casvt / MIND

A simple self hosted reminder application that can send push notifications to your device. Set the reminder and forget about it!
https://casvt.github.io/MIND/
GNU General Public License v3.0
201 stars 10 forks source link

Repeated reminder doesn't work when interval is in days #40

Closed dhanadhan closed 1 year ago

dhanadhan commented 1 year ago

Description of the bug I looked at the current issues, but it seems no one else is having the issue I am experiencing 🤔 I run MIND on a docker container running on the latest Ubuntu OS. I send reminders to Discord webhook URL. They work great on the same day, but then I get nothing for the repeated reminders on the next day and onwards. Even the new reminders I create don't work from this point. Every time when I reboot the docker container, it sends only 1 missed reminder. But nothing else works. I have reinstalled MIND multiple times with the Correct Timezone variable, but the same issue occurs. I also tried changing the time from 24 hours to 12 hours format on Ubuntu, but that didn't help either. I don't see any logs anywhere so it's hard to determine what's wrong. Container logs just displays "No log line matching the '' filter".

To Reproduce

Expected behaviour Get repeated reminders everyday on the scheduled time

Version info

dhanadhan commented 1 year ago

I just reinstalled with the below image to see if that resolves the issue. image: mrcas/noted:latest

EDIT: Didn't work, reminders stopped working the next day.

dhanadhan commented 1 year ago

Still can't get this to work after a day. Is it broken with Discord only?

Casvt commented 1 year ago

Does your reminder disappear after it has run for the first (and last) time? Or does it stay in your library, but just never trigger again?

dhanadhan commented 1 year ago

Does your reminder disappear after it has run for the first (and last) time? Or does it stay in your library, but just never trigger again?

Thanks for replying.

No, it stays in my library with the timestamp of when it last ran and never triggers. If I restart the container, it sends that missed reminder, but doesn't adjust to the next schedule reminder.

I tried something last night and it looks somewhat promising. Instead of discord.com webhook url that I copied directly from the Discord app, I added discordapp.com webhook url with the same id and token. I got an alert this morning that I set last night. Let's see how the rest of the day and tomorrow goes.

dhanadhan commented 1 year ago

@Casvt So for the most part, repeated hourly reminders work fine even after a day. It seems that a 1 day repeat reminders screws everything up. When a 1 day reminder is triggered, it doesn't reset to the next schedule date and time allowing other reminder to continue. It just get stuck at the last reminder sent time and so it halts all other reminders. Only way to get it working again is to delete that stuck reminder and reboot the container. I'll try one out with 24 hours reminder instead of 1 day and see if that works.

dhanadhan commented 1 year ago

@Casvt So for the most part, hourly reminders work fine even after a day. It seems that a 1 day reminders screws everything up. When a 1 day reminder is triggered, it doesn't reset to the next schedule date and time allowing other reminder to continue. It just get stuck at the last reminder sent time and so it halts all other reminders. Only way to get it working again is to delete that stuck reminder and reboot the container. I'll try one out with 24 hours reminder instead of 1 day and see if that works.

Confirmed 1 Day repeat reminder is an issue because they don't reset to the next day. I tested this by adding one reminder that triggers at the next min and repeats every 1 day. It sent the alert, but didn't reset to the next day. So all upcoming reminders were halted. Then I added one that repeats every 24 hours, and that reset to the next day without any issue. As a workaround, repeat reminders every x hour(s) instead of every x day if others have the same issue.

Casvt commented 1 year ago

Alright thank you. So the problem is that repeated reminders don't work when the interval is set in days.

You are running the latest version (mrcas/mind:latest) right? Just checking.

The Discord url isn't the problem. If you can get a notification from it once, you can also get it repeatedly.

The notification that you did get, was that one on time? Did you get it at the time that you set it to? Because if not, that could have to do with the timezone settings.

dhanadhan commented 1 year ago

Alright thank you. So the problem is that repeated reminders don't work when the interval is set in days.

You are running the latest version (mrcas/mind:latest) right? Just checking.

The Discord url isn't the problem. If you can get a notification from it once, you can also get it repeatedly.

The notification that you did get, was that one on time? Did you get it at the time that you set it to? Because if not, that could have to do with the timezone settings.

Correct, the problem seems to be when the interval is set to day(s).

Yes, running the latest version. I was using the mind:latest image, but switched to noted:latest image to see if that resolves the issue. Both images had the same issue.

Yes, the first notification is always on time. I can never get the next one when interval is set to day(s). I don't think timezone is an issue because I have set it correctly in docker compose and everything works perfectly fine on hourly intervals.

Casvt commented 1 year ago

I have found the bug in the code that causes this behaviour. The same problem exists with repeating every x months or years actually. I'll fix this as soon as I can and let you know :)

Casvt commented 1 year ago

Bug fixed. This fix will be included in the next release and docker container. Broken reminders that are currently in your library will automatically be fixed by MIND and new ones will now work correctly of course.

If you want a technical explanation of what the bug was:

To determine what the next timestamp is for a reminder, the dateutil.relativedelta.relativedelta class is used. You supply a time delta (like "every day") and when you give a timestamp, it will calculate the next timestamp with the time delta applied. So 12-3-2023 + TD(1 day) = 13-3-2023.

To create this time delta, we need to supply the info like this: day=1. However, there is a difference between supplying day=1 and days=1.

And this is also where the bug was. I used day=1 for the timedelta but the resulting timestamp from that will be at the beginning of the month instead of the next day. So I changed it so that days=1 is used instead. I was, accidentally, already using minutes instead of minute which is why this wasn't a problem for those units.

In my opinion, such big difference in working shouldn't be dependant on one 's', but that is out of my control and my personal opinion.

Casvt commented 1 year ago

New release is out and so is the new docker container.

dhanadhan commented 1 year ago

Thank you so much for fixing it so quickly.

I just pulled the new image and confirmed working.