improved websocket connection management#3797
Conversation
|
@camdecoster This is ready for review, I removed the callback adoption that was not working for multi worker production environment. |
|
| (acc: any[], cb: any) => { | ||
| // Only re-trigger no-output callbacks with no inputs | ||
| // These are the "persistent" callbacks that should restart | ||
| if (cb.noOutput && cb.inputs.length === 0) { |
There was a problem hiding this comment.
This checks for persistent callbacks, but why doesn't it look at the persistent flag (from isLoading.ts)?
There was a problem hiding this comment.
No it's actually just the no Output and no Inputs since those cannot be restarted after startup. Other cases can use reload button or other mechanism.
| } | ||
|
|
||
| // Handle tab visibility changes | ||
| document.addEventListener('visibilitychange', () => { |
There was a problem hiding this comment.
Is there a situation where you'd need to remove the event listener?
There was a problem hiding this comment.
No, it's for the complete page lifecycle.
| # Exit gracefully on disconnect | ||
| raise PreventUpdate | ||
| set_props("progress", {"children": str(i * 10)}) | ||
| await asyncio.sleep(0.2) |
There was a problem hiding this comment.
Will this hit the 2s timeout when it makes a new call every 0.2s?
| - [#3669](https://github.com/plotly/dash/pull/3669) Selection for DataTable cleared with custom action settings | ||
| - [#3680](https://github.com/plotly/dash/pull/3680) Added `search_order` prop to `Dropdown` to allow users to preserve original option order during search | ||
| - Added `csrf_token_name` and `csrf_header_name` config options to allow configuring the CSRF cookie and header names. Fixes [#729](https://github.com/plotly/dash/issues/729) | ||
| - [#3797](https://github.com/plotly/dash/pull/3797) Improved websocket callback management. |
There was a problem hiding this comment.
Will the changes in this fix be documented somewhere besides this changelog entry?
There was a problem hiding this comment.
A more comprehensive guide for the websocket shutdown management can be found on the WebsocketCallback docstring and in the .ai/ARCHITECTURE.md



Fix #3788 and fix #3790