Skip to content

Sendbird patches on top of redis-py 7.1.0#29

Open
bellatoris wants to merge 10 commits into
upstream/7.1.0from
sendbird/7.1-sb1
Open

Sendbird patches on top of redis-py 7.1.0#29
bellatoris wants to merge 10 commits into
upstream/7.1.0from
sendbird/7.1-sb1

Conversation

@bellatoris
Copy link
Copy Markdown

@bellatoris bellatoris commented Jan 28, 2026

Summary

This PR contains all Sendbird-specific patches applied on top of upstream redis-py v7.1.0.

Patches included (9 commits)

1. Envoy Compatibility (c62d8c1)

  • Use EVAL instead of SCRIPT LOAD + EVALSHA in NoScriptError fallback
  • Fixes compatibility with Envoy proxy which may not handle SCRIPT LOAD properly

2. Sharded PubSub - Replica Support (03285de)

  • Add replica=False parameter to ClusterPubSub.__init__
  • Allow reading from replicas on cluster pubsub subscribe

3. Sharded PubSub - Send One by One (a9cc9eb)

  • Send ssubscribe commands one by one for Redis cluster

4. Sharded PubSub - By Slot (a55e5d5)

  • Subscribe to keys separately by slot for proper cluster routing

5. PubSub Connection Lock (b335145)

  • Add _connection_lock to PubSub.execute_command
  • Ensures only one connection is created in concurrent scenarios

6. BaseException Handling in Pipeline (0b6aba3)

  • Add outer except BaseException handler in PipelineStrategy._send_cluster_commands
  • Disconnect connections before releasing on unexpected exceptions
  • Add n.connection = None and clear nodes dict in inner exception handler
  • Add 0.25s sleep on exception for connection pool recovery

7. is_supported_error + Improved Error Handling (3185418)

  • Add is_supported_error() method to AbstractRetry class
  • Update inner get_connection handler to catch BaseException
  • Apply backoff sleep when error is a supported retry error type
  • Only reinitialize nodes manager on ConnectionError/TimeoutError

8. repr for Debugging (22e170b)

  • Add __repr__ to PipelineCommand and NodeCommands for easier debugging

9. Version Bump (87194d6)

  • Set version to 7.1.0+sb1 (PEP 440 compliant)

Tag

7.1.0.sb1 - Points to the version bump commit

Review Checklist

  • Script.__call__ uses eval() not script_load() in NoScriptError handler
  • ClusterPubSub.__init__ has replica parameter
  • PubSub.execute_command has _connection_lock
  • PipelineStrategy._send_cluster_commands has outer except BaseException
  • AbstractRetry has is_supported_error() method
  • Inner get_connection catches BaseException not just (ConnectionError, TimeoutError)
  • Version is 7.1.0+sb1

dlunch and others added 9 commits January 28, 2026 18:27
…reated (#19) (#22)

* Add lock to Pubsub.execute_command to ensure only one connection is created

* Add tests
- Add n.connection = None after releasing in inner exception handler
- Clear nodes dict after releasing to allow clean retry
- Add outer except BaseException handler that disconnects connections
  before releasing them to prevent socket data corruption
- Add 0.25s sleep on exception for connection pool recovery
- Add is_supported_error() method to AbstractRetry class for checking
  if an error type is in the supported errors list
- Update PipelineStrategy inner get_connection handler to catch BaseException
- Apply backoff sleep when error is a supported retry error type
- Only reinitialize nodes manager on ConnectionError/TimeoutError
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.

4 participants