Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 70e63c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Register nip66.historyRetentionHours in defaults, trim history on read, use rank-based Redis cleanup, isolate history failures from NIP-66 publish, and preserve timeline selection during dashboard polling.
| if (selectedNetworkHealthRunAt && networkHealthHistoryRuns.length > 0) { | ||
| const selected = networkHealthHistoryRuns.find((run) => run?.runAt === selectedNetworkHealthRunAt) | ||
| if (selected) { | ||
| displaySnapshot = selected | ||
| } | ||
| } else if (snapshot?.runAt) { | ||
| selectedNetworkHealthRunAt = snapshot.runAt |
There was a problem hiding this comment.
refreshNetworkHealth now treats the first automatically selected snapshot as a user-selected historical run. After the next probe finishes, polling still displays that first run while it remains in networkHealthHistoryRuns, even if the operator never clicked the timeline. An old healthy result can hide a newer failure.
Keep following the latest snapshot by default, and preserve a historical run only after an explicit click.
Knowledge Base Used: Admin dashboard and controls
| const size = await this.cache.getSortedSetSize(RELAY_PROBE_HISTORY_KEY) | ||
|
|
||
| if (size > maxRuns) { | ||
| await this.cache.removeRangeByRankFromSortedSet(RELAY_PROBE_HISTORY_KEY, 0, size - maxRuns - 1) |
There was a problem hiding this comment.
trim reads the history size and deletes by rank in separate Redis calls. Since history requests now also call trim, two requests can read the same size and both remove the same number of oldest runs. The second deletion removes runs the first call kept. For example, after lowering maxRuns from 168 to 1, two overlapping reads can delete all history.
Make the count-and-delete step atomic, or use a rank range that keeps the newest maxRuns entries without first reading the size.
Description
GET /admin/network-health/history?limit=nip66.historyRetentionRuns(default 168) and optionalhistoryRetentionHoursRelated Issue
Closes - #800
Motivation and Context
How Has This Been Tested?
pnpm run test:unitScreenshots (if appropriate):
Types of changes
Checklist: