dash-core-components
dash-core-components copied to clipboard
dcc.Interval as background process
Issue discovered in community: https://community.plot.ly/t/dash-working-as-a-background-process/10412
It looks like dcc.Interval
freezes when the app is not in the foreground. once the app is the in the foreground again, the dcc.Interval
process "catches up". This behavior appears to change depending on the browser (with firefox there's less of a freeze when inactive.)
It looks like this might be the browsers themselves trying to avoid hogging resources. I'm not sure if there's a way to override this behavior, but even if there is it might not be desirable.
If it's not desirable, I could imagine other tactics to deal with this. Perhaps a reload
button that redraws the app and associated dcc.Interval
component (I think that should clear the buildup of updates), or perhaps even another component that detects whether the app is active or inactive, which can then be used to turn off the dcc.Interval
More context: https://stackoverflow.com/questions/5927284/
There are a few exceptions to the aggressive background tab throttling. One of these would be to use a websocket connection instead of http requests to establish the Dash connection as this is one of the automatically exempted cases.
https://developers.google.com/web/updates/2017/03/background_tabs
There are a number of automatic exemptions from this throttling: Applications playing audio are considered foreground and aren’t throttled. Applications with real-time connections (WebSockets and WebRTC), to avoid closing these connections by timeout. The run-timers-once-a-second rule is still applied in these cases.
Or not, depending on what run-timers-once-a-second rule
means exactly. Or yes, as webworkers seem to be generally exempted from that rule.
Hi there. Are there any updates on this issue?
Hi guys! Is there some working solution? It totally brakes if you want to plot real time series
@chriddyp Hi, any fix for this problem? I tried a few things, nothing seems to be working:
- Changed the discard property for the dash app. chrome://dicards
- Added audio component to play music in the background to keep the tab active.
- Changed browser performance settings.
@akorneychuk @scotgopal Were you able to resolve it?