@@ -285,6 +285,7 @@ public async Task RunClientAsync(IDuplexPipe pipe, RedisServer.Node node = null,
285285 {
286286 node ??= DefaultNode ;
287287 client = AddClient ( node , state ) ;
288+
288289 while ( ! client . Closed )
289290 {
290291 var readResult = await pipe . Input . ReadAsync ( ) . ConfigureAwait ( false ) ;
@@ -298,7 +299,8 @@ public async Task RunClientAsync(IDuplexPipe pipe, RedisServer.Node node = null,
298299 var response = Execute ( client , request ) ;
299300 client . ResetAfterRequest ( ) ;
300301
301- await WriteResponseAsync ( client , pipe . Output , response , client . Protocol ) ;
302+ WriteResponse ( client , pipe . Output , response , client . Protocol ) ;
303+ await pipe . Output . FlushAsync ( ) . ConfigureAwait ( false ) ;
302304
303305 // advance the buffer to account for the message we just read
304306 buffer = buffer . Slice ( consumed ) ;
@@ -344,7 +346,7 @@ public virtual void Log(string message)
344346 }
345347 }
346348
347- public static async ValueTask WriteResponseAsync ( RedisClient client , PipeWriter output , TypedRedisValue value , RedisProtocol protocol )
349+ public static void WriteResponse ( RedisClient client , IBufferWriter < byte > output , TypedRedisValue value , RedisProtocol protocol )
348350 {
349351 static void WritePrefix ( IBufferWriter < byte > output , char prefix )
350352 {
@@ -421,7 +423,7 @@ static void WritePrefix(IBufferWriter<byte> output, char prefix)
421423 throw new InvalidOperationException ( "Array element cannot be nil, index " + i ) ;
422424
423425 // note: don't pass client down; this would impact SkipReplies
424- await WriteResponseAsync ( null , output , item , protocol ) ;
426+ WriteResponse ( null , output , item , protocol ) ;
425427 }
426428 break ;
427429 default :
@@ -438,8 +440,6 @@ static void WritePrefix(IBufferWriter<byte> output, char prefix)
438440 }
439441 }
440442
441- await output . FlushAsync ( ) . ConfigureAwait ( false ) ;
442-
443443 static RespPrefix ToResp2 ( RespPrefix type )
444444 {
445445 switch ( type )
0 commit comments