mirror of
https://github.com/status-im/status-go.git
synced 2025-01-19 11:15:08 +00:00
0babdad17b
* chore: upgrade go-waku to v0.5 * chore: add println and logs to check what's being stored in the enr, and preemptively delete the multiaddr field (#3219) * feat: add wakuv2 test (#3218)
27 lines
439 B
Go
27 lines
439 B
Go
package metricshelper
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
)
|
|
|
|
const capacity = 8
|
|
|
|
var stringPool = sync.Pool{New: func() any {
|
|
s := make([]string, 0, capacity)
|
|
return &s
|
|
}}
|
|
|
|
func GetStringSlice() *[]string {
|
|
s := stringPool.Get().(*[]string)
|
|
*s = (*s)[:0]
|
|
return s
|
|
}
|
|
|
|
func PutStringSlice(s *[]string) {
|
|
if c := cap(*s); c < capacity {
|
|
panic(fmt.Sprintf("expected a string slice with capacity 8 or greater, got %d", c))
|
|
}
|
|
stringPool.Put(s)
|
|
}
|