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()
|
||||
// get to position so window.Do starts on the correct value
|
||||
mw.window = mw.window.Next()
|
||||
mw.wMu.Unlock()
|
||||
|
||||
mw.wMu.RLock()
|
||||
values := make([]*api.Metric, 0, mw.window.Len())
|
||||
mw.window.Do(func(v interface{}) {
|
||||
if i, ok := v.(*api.Metric); ok {
|
||||
|
@ -82,11 +84,8 @@ func (mw *Window) All() []*api.Metric {
|
|||
values = append([]*api.Metric{i}, values...)
|
||||
}
|
||||
})
|
||||
mw.window = mw.window.Prev()
|
||||
mw.wMu.Unlock()
|
||||
copyValues := make([]*api.Metric, len(values))
|
||||
copy(copyValues, values)
|
||||
return copyValues
|
||||
mw.wMu.RUnlock()
|
||||
return values
|
||||
}
|
||||
|
||||
// Distribution returns the deltas between all the current
|
||||
|
|
Loading…
Reference in New Issue
Block a user