@@ -181,21 +181,25 @@ public Subscription(CommandFlags flags)
181181 /// <summary>
182182 /// Gets the configured (P)SUBSCRIBE or (P)UNSUBSCRIBE <see cref="Message"/> for an action.
183183 /// </summary>
184- internal Message GetMessage ( RedisChannel channel , SubscriptionAction action , CommandFlags flags , bool internalCall )
184+ internal Message GetSubscriptionMessage ( RedisChannel channel , SubscriptionAction action , CommandFlags flags , bool internalCall )
185185 {
186186 var command = action switch // note that the Routed flag doesn't impact the message here - just the routing
187187 {
188188 SubscriptionAction . Subscribe => ( channel . Options & ~ RedisChannel . RedisChannelOptions . KeyRouted ) switch
189189 {
190190 RedisChannel . RedisChannelOptions . None => RedisCommand . SUBSCRIBE ,
191+ RedisChannel . RedisChannelOptions . MultiNode => RedisCommand . SUBSCRIBE ,
191192 RedisChannel . RedisChannelOptions . Pattern => RedisCommand . PSUBSCRIBE ,
193+ RedisChannel . RedisChannelOptions . Pattern | RedisChannel . RedisChannelOptions . MultiNode => RedisCommand . PSUBSCRIBE ,
192194 RedisChannel . RedisChannelOptions . Sharded => RedisCommand . SSUBSCRIBE ,
193195 _ => Unknown ( action , channel . Options ) ,
194196 } ,
195197 SubscriptionAction . Unsubscribe => ( channel . Options & ~ RedisChannel . RedisChannelOptions . KeyRouted ) switch
196198 {
197199 RedisChannel . RedisChannelOptions . None => RedisCommand . UNSUBSCRIBE ,
200+ RedisChannel . RedisChannelOptions . MultiNode => RedisCommand . UNSUBSCRIBE ,
198201 RedisChannel . RedisChannelOptions . Pattern => RedisCommand . PUNSUBSCRIBE ,
202+ RedisChannel . RedisChannelOptions . Pattern | RedisChannel . RedisChannelOptions . MultiNode => RedisCommand . PUNSUBSCRIBE ,
199203 RedisChannel . RedisChannelOptions . Sharded => RedisCommand . SUNSUBSCRIBE ,
200204 _ => Unknown ( action , channel . Options ) ,
201205 } ,
@@ -432,7 +436,7 @@ internal bool EnsureSubscribedToServer(Subscription sub, RedisChannel channel, C
432436
433437 // TODO: Cleanup old hangers here?
434438 sub . SetCurrentServer ( null ) ; // we're not appropriately connected, so blank it out for eligible reconnection
435- var message = sub . GetMessage ( channel , SubscriptionAction . Subscribe , flags , internalCall ) ;
439+ var message = sub . GetSubscriptionMessage ( channel , SubscriptionAction . Subscribe , flags , internalCall ) ;
436440 var selected = multiplexer . SelectServer ( message ) ;
437441 return ExecuteSync ( message , sub . Processor , selected ) ;
438442 }
@@ -446,7 +450,7 @@ internal void ResubscribeToServer(Subscription sub, RedisChannel channel, Server
446450 {
447451 // we'll *try* for a simple resubscribe, following any -MOVED etc, but if that fails: fall back
448452 // to full reconfigure; importantly, note that we've already recorded the disconnect
449- var message = sub . GetMessage ( channel , SubscriptionAction . Subscribe , CommandFlags . None , false ) ;
453+ var message = sub . GetSubscriptionMessage ( channel , SubscriptionAction . Subscribe , CommandFlags . None , false ) ;
450454 _ = ExecuteAsync ( message , sub . Processor , serverEndPoint ) . ContinueWith (
451455 t => multiplexer . ReconfigureIfNeeded ( serverEndPoint . EndPoint , false , cause : cause ) ,
452456 TaskContinuationOptions . OnlyOnFaulted ) ;
@@ -486,7 +490,7 @@ public Task<bool> EnsureSubscribedToServerAsync(Subscription sub, RedisChannel c
486490
487491 // TODO: Cleanup old hangers here?
488492 sub . SetCurrentServer ( null ) ; // we're not appropriately connected, so blank it out for eligible reconnection
489- var message = sub . GetMessage ( channel , SubscriptionAction . Subscribe , flags , internalCall ) ;
493+ var message = sub . GetSubscriptionMessage ( channel , SubscriptionAction . Subscribe , flags , internalCall ) ;
490494 server ??= multiplexer . SelectServer ( message ) ;
491495 return ExecuteAsync ( message , sub . Processor , server ) ;
492496 }
@@ -509,7 +513,7 @@ private bool UnsubscribeFromServer(Subscription sub, RedisChannel channel, Comma
509513 {
510514 if ( sub . GetCurrentServer ( ) is ServerEndPoint oldOwner )
511515 {
512- var message = sub . GetMessage ( channel , SubscriptionAction . Unsubscribe , flags , internalCall ) ;
516+ var message = sub . GetSubscriptionMessage ( channel , SubscriptionAction . Unsubscribe , flags , internalCall ) ;
513517 return multiplexer . ExecuteSyncImpl ( message , sub . Processor , oldOwner ) ;
514518 }
515519 return false ;
@@ -531,7 +535,7 @@ private Task<bool> UnsubscribeFromServerAsync(Subscription sub, RedisChannel cha
531535 {
532536 if ( sub . GetCurrentServer ( ) is ServerEndPoint oldOwner )
533537 {
534- var message = sub . GetMessage ( channel , SubscriptionAction . Unsubscribe , flags , internalCall ) ;
538+ var message = sub . GetSubscriptionMessage ( channel , SubscriptionAction . Unsubscribe , flags , internalCall ) ;
535539 return multiplexer . ExecuteAsyncImpl ( message , sub . Processor , asyncState , oldOwner ) ;
536540 }
537541 return CompletedTask < bool > . FromResult ( true , asyncState ) ;
0 commit comments