@@ -294,7 +294,10 @@ public async Task RunClientAsync(IDuplexPipe pipe, RedisServer.Node node = null,
294294 {
295295 // process a completed request
296296 RedisRequest request = new ( buffer . Slice ( 0 , consumed ) , ref commandLease ) ;
297+ request = request . WithClient ( client ) ;
297298 var response = Execute ( client , request ) ;
299+ client . ResetAfterRequest ( ) ;
300+
298301 await WriteResponseAsync ( client , pipe . Output , response , client . Protocol ) ;
299302
300303 // advance the buffer to account for the message we just read
@@ -529,10 +532,14 @@ public virtual TypedRedisValue Execute(RedisClient client, in RedisRequest reque
529532 if ( result . IsError ) Interlocked . Increment ( ref _totalErrorCount ) ;
530533 return result ;
531534 }
532- catch ( KeyMovedException moved ) when ( GetNode ( moved . HashSlot ) is { } node )
535+ catch ( KeyMovedException moved )
533536 {
534- OnMoved ( client , moved . HashSlot , node ) ;
535- return TypedRedisValue . Error ( $ "MOVED { moved . HashSlot } { node . Host } :{ node . Port } ") ;
537+ if ( GetNode ( moved . HashSlot ) is { } node )
538+ {
539+ OnMoved ( client , moved . HashSlot , node ) ;
540+ return TypedRedisValue . Error ( $ "MOVED { moved . HashSlot } { node . Host } :{ node . Port } ") ;
541+ }
542+ return TypedRedisValue . Error ( $ "ERR key has been migrated from slot { moved . HashSlot } , but the new owner is unknown") ;
536543 }
537544 catch ( CrossSlotException )
538545 {
0 commit comments