Skip to content

Commit 9e24679

Browse files
committed
address pr comments
1 parent 56e3ae6 commit 9e24679

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

internal/pool/conn.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,15 @@ func (cn *Conn) CompareAndSwapUsable(old, new bool) bool {
243243
StateIdle,
244244
)
245245
return err == nil
246-
} else {
247-
// Trying to make unusable - transition from IDLE to UNUSABLE
248-
// This is typically for acquiring the connection for background operations
249-
// Use predefined slice to avoid allocation
250-
_, err := cn.stateMachine.TryTransition(
251-
validFromIdle,
252-
StateUnusable,
253-
)
254-
return err == nil
255246
}
247+
// Trying to make unusable - transition from IDLE to UNUSABLE
248+
// This is typically for acquiring the connection for background operations
249+
// Use predefined slice to avoid allocation
250+
_, err := cn.stateMachine.TryTransition(
251+
validFromIdle,
252+
StateUnusable,
253+
)
254+
return err == nil
256255
}
257256

258257
// IsUsable returns true if the connection is safe to use for new commands (lock-free).

0 commit comments

Comments
 (0)