Here are the requirements: (not the real case, just very simplied version)
There is some sort of promotion which lasts for a week.
The selected users who may benefit from the promotion is fixed at the beginning.
Everyday, each selected user gets some bonus(say some credit points) from the system.
I'm thinking about implementing it with state pattern, scheduling some refresh events with a delay of 24 hours. Upon receiving the event, schedule another refresh event with a delay of 24 hours too, until it's finished.
But there is a problem. What if the process (the server) running the program gets shut down then restarted 2 days after? I would like the system to behave correctly by redelivering the promised bonuses of the missed 2 days.
How can I do that?
So, my real question is, ”How do you model something related to theses kind of problems (time related events)?“ What's the nature of this problem? I may have described it but I don't recognize it very well.
Thanks in advance.