mirror of
https://github.com/niusmallnan/steve.git
synced 2025-08-18 13:17:03 +00:00
If the user doesn't specify a resourceVersion default to "" not latest
This commit is contained in:
parent
9f5d802708
commit
0414d4acf5
@ -282,21 +282,8 @@ func returnErr(err error, c chan types.APIEvent) {
|
|||||||
|
|
||||||
func (s *Store) listAndWatch(apiOp *types.APIRequest, k8sClient dynamic.ResourceInterface, schema *types.APISchema, w types.WatchRequest, result chan types.APIEvent) {
|
func (s *Store) listAndWatch(apiOp *types.APIRequest, k8sClient dynamic.ResourceInterface, schema *types.APISchema, w types.WatchRequest, result chan types.APIEvent) {
|
||||||
rev := w.Revision
|
rev := w.Revision
|
||||||
if rev == "-1" {
|
if rev == "-1" || rev == "0" {
|
||||||
rev = ""
|
rev = ""
|
||||||
} else {
|
|
||||||
// ensure the revision is valid or get the latest one
|
|
||||||
list, err := k8sClient.List(apiOp.Context(), metav1.ListOptions{
|
|
||||||
Limit: 1,
|
|
||||||
ResourceVersion: rev,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
returnErr(errors.Wrapf(err, "failed to list %s", schema.ID), result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if rev == "" {
|
|
||||||
rev = list.GetResourceVersion()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout := int64(60 * 30)
|
timeout := int64(60 * 30)
|
||||||
|
Loading…
Reference in New Issue
Block a user