mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-02-17 16:31:45 +01:00
Resize the buffers and put them into the pool
This commit is contained in:
@@ -237,9 +237,10 @@ func (b *buffer) free(t int64) (delme bool, n int) {
|
|||||||
n += m
|
n += m
|
||||||
if delme {
|
if delme {
|
||||||
b.prev.next = nil
|
b.prev.next = nil
|
||||||
if cap(b.prev.data) == BufferCap {
|
if cap(b.prev.data) != BufferCap {
|
||||||
bufferPool.Put(b.prev)
|
b.prev.data = make([]schema.Float, 0, BufferCap)
|
||||||
}
|
}
|
||||||
|
bufferPool.Put(b.prev)
|
||||||
b.prev = nil
|
b.prev = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,9 +189,10 @@ func (l *Level) free(t int64) (int, error) {
|
|||||||
delme, m := b.free(t)
|
delme, m := b.free(t)
|
||||||
n += m
|
n += m
|
||||||
if delme {
|
if delme {
|
||||||
if cap(b.data) == BufferCap {
|
if cap(b.data) != BufferCap {
|
||||||
bufferPool.Put(b)
|
b.data = make([]schema.Float, 0, BufferCap)
|
||||||
}
|
}
|
||||||
|
bufferPool.Put(b)
|
||||||
l.metrics[i] = nil
|
l.metrics[i] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user