mirror of
https://github.com/niusmallnan/steve.git
synced 2025-06-21 12:17:08 +00:00
Fix counts
This commit is contained in:
parent
fe57a07726
commit
eda3ecf987
@ -228,7 +228,7 @@ func (h *clusterCache) start() {
|
|||||||
|
|
||||||
key := toKey(event.obj)
|
key := toKey(event.obj)
|
||||||
if event.oldObj != nil {
|
if event.oldObj != nil {
|
||||||
_, err := callAll(h.addHandlers.List(), event.gvr, key, event.obj, event.oldObj)
|
_, err := callAll(h.changeHandlers.List(), event.gvr, key, event.obj, event.oldObj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("failed to handle add event: %v", err)
|
logrus.Errorf("failed to handle add event: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,7 @@ func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, w types.
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
itemCount = removeCounts(itemCount, namespace, oldSummary)
|
itemCount = removeCounts(itemCount, namespace, oldSummary)
|
||||||
|
itemCount = addCounts(itemCount, namespace, summary)
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -242,7 +243,7 @@ func getInfo(obj interface{}) (name string, namespace string, revision int, summ
|
|||||||
|
|
||||||
func removeCounts(itemCount ItemCount, ns string, summary summary.Summary) ItemCount {
|
func removeCounts(itemCount ItemCount, ns string, summary summary.Summary) ItemCount {
|
||||||
itemCount.Summary = removeSummary(itemCount.Summary, summary)
|
itemCount.Summary = removeSummary(itemCount.Summary, summary)
|
||||||
if ns == "" {
|
if ns != "" {
|
||||||
itemCount.Namespaces[ns] = removeSummary(itemCount.Namespaces[ns], summary)
|
itemCount.Namespaces[ns] = removeSummary(itemCount.Namespaces[ns], summary)
|
||||||
}
|
}
|
||||||
return itemCount
|
return itemCount
|
||||||
@ -250,7 +251,7 @@ func removeCounts(itemCount ItemCount, ns string, summary summary.Summary) ItemC
|
|||||||
|
|
||||||
func addCounts(itemCount ItemCount, ns string, summary summary.Summary) ItemCount {
|
func addCounts(itemCount ItemCount, ns string, summary summary.Summary) ItemCount {
|
||||||
itemCount.Summary = addSummary(itemCount.Summary, summary)
|
itemCount.Summary = addSummary(itemCount.Summary, summary)
|
||||||
if ns == "" {
|
if ns != "" {
|
||||||
itemCount.Namespaces[ns] = addSummary(itemCount.Namespaces[ns], summary)
|
itemCount.Namespaces[ns] = addSummary(itemCount.Namespaces[ns], summary)
|
||||||
}
|
}
|
||||||
return itemCount
|
return itemCount
|
||||||
|
Loading…
Reference in New Issue
Block a user