shelkesays opened a new pull request, #40512:
URL: https://github.com/apache/superset/pull/40512

   ### SUMMARY
   The manual Refresh dashboard button currently fires all chart data requests 
in parallel with no delay between them. On dashboards with many charts this 
causes worker saturation and timeouts on the backend.
   
   This change routes the manual refresh through the staggered branch of 
`fetchCharts` that auto-refresh already uses. It adds a new server config 
`SUPERSET_DASHBOARD_MANUAL_REFRESH_STAGGER_MS` that controls how many 
milliseconds the chart requests are spread across. The default is 5000 ms.
   
   The behavior is configurable in two ways:
   
   1. Operators can change `SUPERSET_DASHBOARD_MANUAL_REFRESH_STAGGER_MS` in 
`superset_config.py` to widen or narrow the window for their deployment.
   2. Setting the same config to `0` keeps the older behavior where every chart 
request fires at the same time.
   
   Per-dashboard control via the existing `stagger_time` and `stagger_refresh` 
metadata still applies the same way it does for auto-refresh.
   
   Auto-refresh behavior is unchanged. This is a small addition on top of 
#37018, which fixed the nested-tab cascade. The two are independent.
   
   Fixes #40511.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A, no UI change. Network panel shows the difference.
   
   Before: N simultaneous POSTs at t=0 for N charts on the dashboard.
   After: N POSTs spread across 
max(SUPERSET_DASHBOARD_MANUAL_REFRESH_STAGGER_MS, dashboard.stagger_time 
metadata).
   
   ### TESTING INSTRUCTIONS
   1. Open a dashboard with 10 or more charts in a dev environment.
   2. Open DevTools and filter Network by `chart/data`.
   3. Click Refresh dashboard.
   4. Confirm the POSTs spread across about 5 seconds instead of firing at once.
   5. To verify operator configurability, set 
`SUPERSET_DASHBOARD_MANUAL_REFRESH_STAGGER_MS = 12000` in `superset_config.py`, 
restart the web tier, and refresh again. The window should widen to about 12 
seconds.
   6. To verify the opt-out works, set 
`SUPERSET_DASHBOARD_MANUAL_REFRESH_STAGGER_MS = 0`, restart, and confirm the 
POSTs fire all at once like before.
   7. To verify per-dashboard override, edit the dashboard JSON metadata, set 
`stagger_time` to 15000, save, and refresh. The window should widen to 15 
seconds.
   
   Three unit tests are added in `useHeaderAutoRefresh.test.tsx` covering the 
default, custom, and opt-out cases.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: #40511
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to