I made an addon that plays a noise at the top of every hour. It was just a setTimeout that looped every hour. However, I user reported that it would stop working after a long period of time. To fix the issue, I tried having a setTimeout to check every minute in the background.js and then have that setTimeout function create another setTimeout function when it’s within a minute of the top of the hour. However, all of the setTimeouts stop triggering after a long period of time (like 10 hours for example). Never a consistent period of time and there is no obvious reason why this occurs.
Any ideas or workarounds?
The addon is Grandfather Fox on AMO if you want to download and decompress to view the addon’s source code. I think I may change the setTimeout to a Javascript interval instead of a setTimeout that loops, but I don’t see that fixing the issue. All help is much appreciated.
I’ve added a ton of console.logs into my code and will run it overnight and check the console in the morning to see if there are any errors and at what point the code stops triggering.