1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-12 21:39:30 +00:00

Return resourceversion too old error to UI instead of logging (#667)

* Return watch error instead of logging it

The UI needs to know about watch error like `resourceversion too old` so
we need to return it.

* Sort by resourceVersion as number

The UI makes some assumption on resourceVersion. It assumes they are a
number and they are ordered by the number value. We'll want to fix this
at some point most likely but for now let's give something in a way that
UI wants.

* Remove -d suffix

After much testing, a delete of an object seems to have its own
resourceVersion so we don't need the -d suffix, we can simply use the
new resourceVersion.
This commit is contained in:
Tom Lebreux
2025-06-10 15:29:42 -06:00
committed by GitHub
parent 7db113a1fd
commit cf97607be5
4 changed files with 84 additions and 26 deletions

View File

@@ -451,13 +451,6 @@ func (l *ListOptionIndexer) notifyEvent(eventType watch.EventType, oldObj any, o
}
latestRV := acc.GetResourceVersion()
// Append a -d suffix because the RV might be the same as the previous object
// in the following case:
// - Add obj1 with RV 100
// - Delete obj1 with RV 100
if eventType == watch.Deleted {
latestRV = latestRV + "-d"
}
_, err = tx.Stmt(l.upsertEventsStmt).Exec(latestRV, eventType, toBytes(obj))
if err != nil {
return &db.QueryError{QueryString: l.upsertEventsQuery, Err: err}