SmartProxy
SmartProxy copied to clipboard
fix: subscription refresh not happening sometimes
Since the background scripts in MV3 are non-persistent, they might shut down often, losing all setInterval timers.
If the background script doesn't live longer that refresh period, then it will never refresh.
This commit checks lastTryDate and does setTimeout based on that. If the list has not been refreshed for longer than refreshRate, we'll refresh it immediately.
FYI however there is another bug: if a fetch fails, lastTryDate does not get stored in local storage, so a refresh attempt will happen immediately
as the background script starts.
This is not a big problem.