[chore] update gruf libraries (#996)

* update go-store to v2.0.6: closer callbacks are now only ever called at most once

Signed-off-by: kim <grufwub@gmail.com>

* bump go-store => v2.0.7, go-mutexes => v1.1.4

Signed-off-by: kim <grufwub@gmail.com>

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2022-11-08 09:35:01 +00:00 committed by GitHub
commit 7c0bbd3f6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 62 deletions

View file

@ -1,40 +0,0 @@
package mutexes
// pool is a very simply memory pool.
type pool struct {
current []interface{}
victim []interface{}
alloc func() interface{}
}
// Acquire will returns a sync.RWMutex from pool (or alloc new).
func (p *pool) Acquire() interface{} {
// First try the current queue
if l := len(p.current) - 1; l >= 0 {
v := p.current[l]
p.current = p.current[:l]
return v
}
// Next try the victim queue.
if l := len(p.victim) - 1; l >= 0 {
v := p.victim[l]
p.victim = p.victim[:l]
return v
}
// Lastly, alloc new.
return p.alloc()
}
// Release places a sync.RWMutex back in the pool.
func (p *pool) Release(v interface{}) {
p.current = append(p.current, v)
}
// GC will clear out unused entries from the pool.
func (p *pool) GC() {
current := p.current
p.current = nil
p.victim = current
}