Frun1na opened a new pull request, #4651:
URL: https://github.com/apache/rocketmq-dashboard/pull/4651
### Which Issue(s) This PR Fixes
- Fixes #<BACKFILL>
### Brief Description
In `useQueueBrowser`, an in-flight pull's `finally` block cleared its queue
key from
`pullingRef` unconditionally, even when the request had already gone stale
(an instance or topic
switch bumped the request sequence). After a topic switch the reset effect
clears
`pullingRef` anyway, so for a stale request the delete is at best a no-op —
but there is one
case where it actively corrupts state:
1. A pull is in flight for key `broker-a-0` on topic A.
2. The user switches to topic B. The reset effect clears `pullingRef` and
bumps the sequence,
making the in-flight pull stale.
3. Topic B has a queue with the same broker/queue id, so the user starts a
new pull that
re-claims the same key in `pullingRef`.
4. The stale topic-A pull then settles. Its `finally` deletes the key the
*new* pull just
claimed, so the guard no longer blocks a third click on the same queue —
duplicate
concurrent pulls, with the entries list flickering between their results.
The fix makes the `finally` block respect the same staleness guard the rest
of the handler
already uses: only the current request touches `pullingRef` / `pulling`
state.
### How Did You Test This Change?
```
$ cd web && npx vitest run src/components/__tests__/QueueBrowser.test.tsx
Test Files 1 passed (1)
Tests 10 passed (10)
```
New test `a stale pull does not release the pulling slot claimed by a newer
pull` reproduces the
four steps above and asserts the third click is still deduplicated. It fails
on the pre-fix
code (the stale pull releases the slot and a third `pullMessageAtOffset`
call goes out).
```
$ npx tsc -b # clean
$ npx eslint src/components/QueueBrowser.tsx
src/components/__tests__/QueueBrowser.test.tsx
# 0 errors (2 pre-existing react-refresh
warnings on untouched lines)
```
- [x] I have added tests for my changes
- [x] I have run the existing tests and they pass
--
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]