mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Use ExpandPostings() in NewPostingsCloner()
We should reuse that method, not only because it saves code, but also because that method is a good candidate to use a pool of slices some day. Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
This commit is contained in:
parent
8bc1b41795
commit
14cb8d8696
|
@ -807,11 +807,8 @@ type PostingsCloner struct {
|
|||
// The instance provided shouldn't have been used before (no Next() calls should have been done)
|
||||
// and it shouldn't be used once provided to the PostingsCloner.
|
||||
func NewPostingsCloner(p Postings) *PostingsCloner {
|
||||
var ids []uint64
|
||||
for p.Next() {
|
||||
ids = append(ids, p.At())
|
||||
}
|
||||
return &PostingsCloner{ids: ids, err: p.Err()}
|
||||
ids, err := ExpandPostings(p)
|
||||
return &PostingsCloner{ids: ids, err: err}
|
||||
}
|
||||
|
||||
// Clone returns another independent Postings instance.
|
||||
|
|
Loading…
Reference in a new issue