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

   ### SUMMARY
   
   When Celery workers are unavailable for extended periods (e.g. autoscaling, 
pod restarts), GAQ tasks (`load_chart_data_into_cache` and 
`load_explore_json_into_cache`) accumulate in the queue and get executed hours 
or days later — wasting compute on results nobody is waiting for and producing 
misleading queue-wait metrics.
   
   This PR switches `.delay()` to `.apply_async(expires=...)` for both task 
dispatch sites, using the existing 
`GLOBAL_ASYNC_QUERIES_JWT_EXPIRATION_SECONDS` (default: 1 hour) as the expiry 
value. This is the right bound because once the JWT the client uses to poll for 
results has expired, the client can no longer retrieve them — so there is no 
point executing the task.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — no UI changes.
   
   ### TESTING INSTRUCTIONS
   
   1. Enable Global Async Queries (`GLOBAL_ASYNC_QUERIES_TRANSPORT = "polling"`)
   2. Verify chart data and explore requests still dispatch and complete 
normally
   3. Optionally: stop workers, enqueue tasks, wait past 
`GLOBAL_ASYNC_QUERIES_JWT_EXPIRATION_SECONDS`, restart workers — confirm 
expired tasks are discarded (visible in Celery/Flower logs)
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] 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