MCPcopy
hub / github.com/grafana/dskit / wait

Method wait

cache/memcached_client.go:627–640  ·  view source on GitHub ↗

wait submits an async task and blocks until it completes. This can be used during tests to ensure that async "sets" have completed before attempting to read them.

()

Source from the content-addressed store, hash-verified

625// wait submits an async task and blocks until it completes. This can be used during
626// tests to ensure that async "sets" have completed before attempting to read them.
627func (c *MemcachedClient) wait() error {
628 var wg sync.WaitGroup
629
630 wg.Add(1)
631 err := c.queue.submit(func() {
632 wg.Done()
633 })
634 if err != nil {
635 return err
636 }
637
638 wg.Wait()
639 return nil
640}
641
642func (c *MemcachedClient) trackError(op string, err error, msg ...interface{}) {
643 severity := level.DebugValue()

Calls 4

submitMethod · 0.80
AddMethod · 0.65
DoneMethod · 0.65
WaitMethod · 0.45