MCPcopy
hub / github.com/redis/go-redis / run

Method run

redis.go:294–314  ·  view source on GitHub ↗

run invokes all registered callbacks in registration order and returns the first non-nil error encountered. All callbacks are executed even if an earlier one returns an error.

()

Source from the content-addressed store, hash-verified

292// the first non-nil error encountered. All callbacks are executed even if
293// an earlier one returns an error.
294func (h *onCloseHooks) run() error {
295 if h == nil {
296 return nil
297 }
298 h.mu.Lock()
299 fns := make([]func() error, 0, len(h.order))
300 for _, id := range h.order {
301 if fn := h.hooks[id]; fn != nil {
302 fns = append(fns, fn)
303 }
304 }
305 h.mu.Unlock()
306
307 var firstErr error
308 for _, fn := range fns {
309 if err := fn(); err != nil && firstErr == nil {
310 firstErr = err
311 }
312 }
313 return firstErr
314}
315
316type baseClient struct {
317 opt *Options

Calls

no outgoing calls