mirror of
https://github.com/rancher/steve.git
synced 2025-09-16 15:29:04 +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:
@@ -564,6 +564,8 @@ func (s *Store) watch(apiOp *types.APIRequest, schema *types.APISchema, w types.
|
||||
|
||||
result := make(chan watch.Event)
|
||||
go func() {
|
||||
defer close(result)
|
||||
|
||||
ctx := apiOp.Context()
|
||||
idNamespace, _ := kv.RSplit(w.ID, "/")
|
||||
if idNamespace == "" {
|
||||
@@ -580,10 +582,10 @@ func (s *Store) watch(apiOp *types.APIRequest, schema *types.APISchema, w types.
|
||||
}
|
||||
err := inf.ByOptionsLister.Watch(ctx, opts, result)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
returnErr(err, result)
|
||||
return
|
||||
}
|
||||
logrus.Debugf("closing watcher for %s", schema.ID)
|
||||
close(result)
|
||||
}()
|
||||
return result, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user