Skip to content

#100 -- Fix addPubSubHandler not checking if already added

Nathan Harris requested to merge 100-race-condition into master

Motivation

The extension APIs on Channel for managing Redis Channels are more appropriate to exist on ChannelPipeline directly.

In addition, the method of adding/removing PubSub handlers were not race-condition proof, as evidenced by issue #100 (closed).

Changes Made

  • Add: New API for removing PubSubHandler NIO.ChannelPipeline.removeRedisPubSubHandler(_:)
  • Rename: NIO.Channel.addBaseRedisHandlers() to NIO.ChannelPipeline.addBaseRedisHandlers()
  • Rename: NIO.Channel.addPubSubHandler() to NIO.ChannelPipeline.addRedisPubSubHandler()

Result

Developers should no longer see race conditions when calling RedisClient.subscribe or RedisClient.unsubscribe.

This addresses issue #100 (closed) directly.

Edited by Nathan Harris

Merge request reports