Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
How to get a daily schedule to work with an Electron app? #319
I'm scheduling an action to occur daily at a set time, but it doesn't work (reliably). If scheduled for every 5 minutes, the action seems to occur reliably with the app minimized. If the computer sleeps, when woken the action is run repeatedly (this is fine).
I scheduled the action for Dec 27 @ 9 and it didn't occur. Logging (based on job events) reveals that the schedule was accurately changed, but somehow didn't occur, despite the computer being awake.
I then changed the schedule back to every 5 minutes, and it runs fine. Any advice on what the problem is and how I can go about fixing it? I suspect it has something to do with the computer sleeping for an extended period of time.
@komplexb strange issue indeed. Are you still experiencing the issue? From what I can tell, in the code there's an issue when you define the rule:
rule.dayOfWeek = [0, new schedule.Range(0, 7)]
defining it like this should suffice:
rule.dayOfWeek = new schedule.Range(0, 6)
Apart from that I don't seen anything obviously wrong.
Another thing you could do is trying to reproduce the scenario you described in the issue by using sinon fake timers (if you're not familiar with them, see the tests for examples).
One more thing... if the computer goes to sleep, strange things happen
@santigimeno thanks for getting back in touch. I did some refactors that included reapplying the schedule each time the computer wakes up. That solved it.