sadpandajoe opened a new pull request, #42896:
URL: https://github.com/apache/superset/pull/42896
fix(sqllab): async queries no longer stuck at Running forever
### SUMMARY
`REFRESH_QUERIES`'s stale-poll guard in the SQL Lab reducer discarded any
incoming `Success` update whenever the locally stored query state was
`Running`, `Fetching`, or `Success`. Guarding `Fetching`/`Success` makes
sense (a late-arriving poll response shouldn't clobber a state that's
already at or past `Success`), but `Running` is strictly *before*
`Success` in the query lifecycle, so an incoming `Success` while local
state is `Running` is genuine new information, not a stale duplicate.
For async-mode queries (databases with `allow_run_async` enabled), the
periodic background poller (`QueryAutoRefresh` dispatching
`REFRESH_QUERIES`) is the *only* mechanism that ever updates their state
client-side — `runQuery` only dispatches `querySuccess` directly for the
synchronous case. Once such a query was observed in `Running`, it could
never reach `Success`: every subsequent poll re-applied the same guard
against the same locally-stuck `prevState`, so the query appeared
permanently "running" in the UI (e.g. the SQL Lab Query History pane)
even though it had long since finished on the backend.
This drops `Running` from the blocked-state list so a genuine
`Running -> Success` transition is no longer discarded, while keeping the
`Fetching`/`Success` guard intact for its original purpose.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A. Behavior-only SQL Lab reducer fix (async query status polling); no
visual/layout change.
### TESTING INSTRUCTIONS
1. Run a query against a database with `allow_run_async` enabled.
2. Confirm the query correctly transitions from "Running" to "Success" in
the UI (e.g. Query History) once the backend job completes, instead of
remaining stuck at "Running" indefinitely.
Automated/local checks run:
- `npx jest src/SqlLab/reducers/sqlLab.test.ts` (new + existing tests, 39/39
pass)
- `npx jest src/SqlLab/` (full directory, 45 suites / 423 passed, 1
pre-existing skip)
- `npx oxlint --config oxlint.json --quiet` on changed files (clean)
- `npx oxfmt --check` on changed files (clean)
### ADDITIONAL INFORMATION
- [ ] Has associated issue
- [x] Required feature flags: `SQLLAB_BACKEND_PERSISTENCE` is not required;
reproduction requires a database with `allow_run_async` enabled
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] 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]