Open felicio opened 1 year ago
Notes
Notes
So it looks like Chrome suspends or at least slows down javascript execution in a tab that has no focus. Couldn't find much on the internet on the subject. It would mean that we can't run background tasks, like for example checking periodically on a server using XHR calls and setInterval (I suspect to see the same behavior for setInterval, will write a test if time is with me). – https://stackoverflow.com/questions/6032429/chrome-timeouts-interval-suspended-in-background-tabs
When I go to another tab and come back after a while, all divs transition at the same time and the setTimeOut is completely ignored. – https://stackoverflow.com/questions/6032429/chrome-timeouts-interval-suspended-in-background-tabs#comment47225370_6032429
TL;DR: use Web Workers.
There is a solution to use Web Workers, because they run in separate process and are not slowed down
"Update, Jan 2021 : From Chrome 88+, timers can be throttled to 1 minute in certain conditions. Read more usefulangle.com/web-updates/post/110/…"
The Chromium insider also clarified that aggressive throttling will be automatically disabled for all background tabs “playing audio” as well as for any page where an “active websocket connection is present.”
I tested running setInterval on Chrome 100 with 1 minute interval and locked the screen. The function had been executed in roughly 30-180 second intervals.
What
>Note: Sufficient workaround for Relay at https://github.com/status-im/status-web/pull/288/filesdebug
to*
in Local StoragewakuDisconnectionTimer
interval no longer being firedSee errors (in order) during which messaging is not working:
WebSocket connection to 'wss://node-01.do-ams3.status.test.statusim.net/p2p/16Uiu2HAkukebeXjTQ9QDBeNDWuGfbaSg79wkkhK4vPocLgR6QFDf' failed:
Uncaught (in promise) Error: Muxer already closed
See debug logs.
How
Related