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

Method Release

internal/pool/conn.go:828–831  ·  view source on GitHub ↗

Release releases the connection back to the pool. This is an optimized inline method for the hot path (Put operation). It tries to transition from IN_USE -> IDLE. Returns true if the connection was successfully released, false otherwise. Performance: This is faster than calling GetStateMachine() +

()

Source from the content-addressed store, hash-verified

826// If the state machine ever needs to notify waiters
827// on this transition, update this to use TryTransitionFast().
828func (cn *Conn) Release() bool {
829 // Inline the hot path - single CAS operation
830 return cn.stateMachine.state.CompareAndSwap(uint32(StateInUse), uint32(StateIdle))
831}
832
833// ClearHandoffState clears the handoff state after successful handoff.
834// Makes the connection usable again.

Callers 3

OnPutMethod · 0.45
freeTurnMethod · 0.45
putConnMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected