Skip to content

Fix Sync ClusterPubSub.disconnect() — Potential AttributeError#4036

Open
petyaslavova wants to merge 2 commits intomasterfrom
ps_fix_potential_attribute_error_in_sync_cluster_pubsub
Open

Fix Sync ClusterPubSub.disconnect() — Potential AttributeError#4036
petyaslavova wants to merge 2 commits intomasterfrom
ps_fix_potential_attribute_error_in_sync_cluster_pubsub

Conversation

@petyaslavova
Copy link
Copy Markdown
Collaborator

@petyaslavova petyaslavova commented Apr 16, 2026

Fix Sync ClusterPubSub.disconnect() — Potential AttributeError

Fixes a potential AttributeError in ClusterPubSub.disconnect() when a node's pubsub instance in node_pubsub_mapping has a None connection.
The fix adds a guard check (if pubsub.connection) before calling disconnect(), consistent with the existing check already present for self.connection.
Unit tests are added to verify that disconnect() handles None connections gracefully and still properly disconnects non-None connections.


Note

Low Risk
Small defensive change in cleanup logic with narrow behavioral impact; tests cover both None and non-None connection cases.

Overview
Prevents ClusterPubSub.disconnect() from raising an AttributeError by guarding pubsub.connection.disconnect() calls for entries in node_pubsub_mapping when their connection is None.

Adds unit coverage to ensure disconnect() is a no-op for None connections and still calls disconnect() on existing connections for both the main pubsub and per-node pubsubs.

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

@jit-ci
Copy link
Copy Markdown

jit-ci bot commented Apr 16, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant