Skip to content

refactor(pool): remove redundant Conn.closed atomic field#3783

Merged
ndyakov merged 2 commits intoredis:masterfrom
cxljs:remove-conn-field-closed
Apr 21, 2026
Merged

refactor(pool): remove redundant Conn.closed atomic field#3783
ndyakov merged 2 commits intoredis:masterfrom
cxljs:remove-conn-field-closed

Conversation

@cxljs
Copy link
Copy Markdown
Contributor

@cxljs cxljs commented Apr 21, 2026

The closed field was redundant with stateMachine's StateClosed state. Now IsClosed() and Close() only use the state machine for consistency.


Note

Low Risk
Small refactor that consolidates close-state tracking to the existing state machine; minimal behavioral change but could affect edge cases if any code relied on the atomic flag being set independently of state transitions.

Overview
Removes the redundant Conn.closed atomic field from Conn and eliminates all reads/writes to it.

Conn.IsClosed() and Conn.Close() now rely exclusively on the state machine (StateClosed) to determine and mark closed status, ensuring a single source of truth for connection closure.

Reviewed by Cursor Bugbot for commit 09edbfc. Bugbot is set up for automated code reviews on this repo. Configure here.

The closed field was redundant with stateMachine's StateClosed state.
Now IsClosed() and Close() only use the state machine for consistency.
@cxljs cxljs force-pushed the remove-conn-field-closed branch from 538ac5f to 33d30e7 Compare April 21, 2026 11:17
@ndyakov
Copy link
Copy Markdown
Member

ndyakov commented Apr 21, 2026

👍

Copy link
Copy Markdown
Member

@ndyakov ndyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks.

@ndyakov ndyakov merged commit b5a6f99 into redis:master Apr 21, 2026
68 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants