that has used chrome.alarms to run a task every minute for about three years without issue.
In the past few months I noticed the alarm, which is set to run every minute, is firing erratically, only once every 20 or 30 minutes. If I open the inspection window, it fires every minute as expected, as if the extension has been "woken up".
I could put in more effort to track exactly how often it is firing (suggestions welcome), but I wanted to check here too to see if anyone has any tips.
Has there been any change to when alarms activate? Or, could other extensions or my browsing activity have any impact on when alarms fire? Looking at the docs again, under
chrome.alarms.create, I noticed this line:
> Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more
Unfortunately, there are no details as to why alarms may be delayed further, or by how long they could be delayed. When I first read this, I thought they meant seconds, but now I see it can be up to 30 minutes or more.
For what it's worth, the code that initializes the alarm is
here in the service_worker. I don't think it's anything special.
> On Chrome, unless the extension is loaded unpackaged, alarms it creates are not allowed to fire more than once per minute. If an extension tries to set delayInMinutes to a value < 1, or when to a value < 1 minute in the future, then the alarm will fire after 1 minute. If an extension tries to set periodInMinutes to a value < 1, then the alarm will fire every minute.
Thanks for any help you can offer!
Rob