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

Method cloneOpt

redis.go:361–366  ·  view source on GitHub ↗

cloneOpt clones c.opt while holding optLock to prevent races with initConn which writes to MaintNotificationsConfig.Mode under the same lock.

()

Source from the content-addressed store, hash-verified

359// cloneOpt clones c.opt while holding optLock to prevent races with initConn
360// which writes to MaintNotificationsConfig.Mode under the same lock.
361func (c *baseClient) cloneOpt() *Options {
362 c.optLock.RLock()
363 clone := c.opt.clone()
364 c.optLock.RUnlock()
365 return clone
366}
367
368func (c *baseClient) withTimeout(timeout time.Duration) *baseClient {
369 opt := c.cloneOpt()

Callers 3

withTimeoutMethod · 0.95
newTxMethod · 0.80

Calls 1

cloneMethod · 0.45

Tested by 1