Skip to content

Conversation

bsbodden
Copy link
Collaborator

  • Add get_protocol_version wrapper to safely handle ClusterPipeline objects
  • ClusterPipeline objects lack nodes_manager attribute, causing AttributeError
  • Fallback to protocol "3" when unable to detect version from cluster pipelines
  • Handle both sync and async ClusterPipeline cases

Fixes #365

  - Add get_protocol_version wrapper to safely handle ClusterPipeline objects
  - ClusterPipeline objects lack nodes_manager attribute, causing AttributeError
  - Fallback to protocol "3" when unable to detect version from cluster pipelines
  - Handle both sync and async ClusterPipeline cases

  Fixes #365
@bsbodden bsbodden requested a review from rbs333 September 23, 2025 15:10
@bsbodden bsbodden self-assigned this Sep 23, 2025
Copy link
Collaborator

@rbs333 rbs333 left a comment

Choose a reason for hiding this comment

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

LGTM but want to understand a bit more about why this is the fix so I learn a bit

logger.debug(
"AsyncClusterPipeline without valid _redis_cluster, defaulting to protocol 3"
)
return "3"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bsbodden could you help me unpack this fix a bit?

So we were failing before because the objects was trying to use an attribute nodes_manager that didn't exist. The fix implemented here checks the protocol version and defaults to 3 in the case of not knowing.

Was the fail happening because it was previously defaulting to "2" when in cluster mode vs with other connections types?

I haven't done a ton with protocols in redis so trying to understand some of those key differences.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well shit, it should be 2, not 3 - and I was just able to get a real integration test working with my cluster setup and this won't cut it. Good catch.

@bsbodden bsbodden closed this Sep 23, 2025
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.

AttributeError: 'ClusterPipeline' object has no attribute 'nodes_manager' when using index.load() with Redis Cluster
2 participants