konlue opened a new pull request, #7721:
URL: https://github.com/apache/shenyu/pull/7721
Fixes #7692.
## Summary
`InstanceCheckService#handleBeatInfo` updates only `lastHeartBeatTime` for
an already-known instance identity and drops the `instanceInfo` payload the
beat carries. A restarted process on the same address reporting new metadata
(or any periodic metadata change) is therefore invisible: the cached entry —
and, via the scheduled `syncDB()`, the persisted row — keeps the payload
captured at first sighting.
## Modifications
- In the existing-identity branch of `handleBeatInfo`, refresh
`instanceInfo` when the incoming beat carries a non-blank payload.
Liveness-only beats (blank payload) keep the last known value rather than
wiping it.
- Remove a duplicated `setLastHeartBeatTime` call in the create branch (it
was invoked twice with the same value).
## Verifying this change
- [x] New
`InstanceCheckServiceTest#testHandleBeatInfoRefreshesInstanceInfoOnExistingIdentity`:
same identity reports `version=1.0` then `version=2.0`; asserts the cached
entry observes the refreshed value. Fails on the current code with `expected:
<version=2.0> but was: <version=1.0>` and passes with the fix.
- [x] New
`InstanceCheckServiceTest#testHandleBeatInfoKeepsInstanceInfoWhenBeatCarriesBlank`:
a follow-up beat with a blank payload keeps the last known metadata.
- [x] Targeted tests pass:
```bash
./mvnw -B -ntp -pl shenyu-admin test -Dtest=InstanceCheckServiceTest
```
14/14 green.
- [x] Checkstyle passes:
```bash
./mvnw -B -ntp -pl shenyu-admin checkstyle:check
```
clean.
## Notes
Identity (`ip:port@type#namespace`) is unchanged; only the metadata refresh
behaviour within an existing entry changes. No schema or wire-format change.
--
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]