Revert "attempt copying slice"
This reverts commit 0d4d40513fccd31b9cdc4db369aa87e87c529be4.
This commit is contained in:
parent
46d6cb155d
commit
da3c543ce2
|
@ -74,7 +74,9 @@ func (mw *Window) All() []*api.Metric {
|
||||||
mw.wMu.Lock()
|
mw.wMu.Lock()
|
||||||
// get to position so window.Do starts on the correct value
|
// get to position so window.Do starts on the correct value
|
||||||
mw.window = mw.window.Next()
|
mw.window = mw.window.Next()
|
||||||
|
mw.wMu.Unlock()
|
||||||
|
|
||||||
|
mw.wMu.RLock()
|
||||||
values := make([]*api.Metric, 0, mw.window.Len())
|
values := make([]*api.Metric, 0, mw.window.Len())
|
||||||
mw.window.Do(func(v interface{}) {
|
mw.window.Do(func(v interface{}) {
|
||||||
if i, ok := v.(*api.Metric); ok {
|
if i, ok := v.(*api.Metric); ok {
|
||||||
|
@ -82,11 +84,8 @@ func (mw *Window) All() []*api.Metric {
|
||||||
values = append([]*api.Metric{i}, values...)
|
values = append([]*api.Metric{i}, values...)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
mw.window = mw.window.Prev()
|
mw.wMu.RUnlock()
|
||||||
mw.wMu.Unlock()
|
return values
|
||||||
copyValues := make([]*api.Metric, len(values))
|
|
||||||
copy(copyValues, values)
|
|
||||||
return copyValues
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Distribution returns the deltas between all the current
|
// Distribution returns the deltas between all the current
|
||||||
|
|
Loading…
Reference in New Issue
Block a user