Closed digitive closed 1 year ago
Redcon takes care of the flushing for you. It automatically flushes after handling all commands contained in the client's pipeline packet. In most cases this will be one command per packet.
For every incoming command there will be one handler call, and you should be sending exactly one response. A String, Bulk String, Integer, Error, or Array.
In your case, it appears that you are sending three PONGs for one PING.
The MUTLI/EXEC can work by queuing each command after the MULTI, and sending a "queued" response. Then once EXEC is handled, all the queued commands will be processed at once and all responses are sent together.
Hi @tidwall thanks for prompt response. I was using in the wrong way. For MULTI/EXEC I should send back an array instead of multiple call to conn.WriteString(). All good. Thanks again.
We need a Flush() function on the Conn interface so that the server can flush the response when multiple line of response accumulated. For example
When client sends
ping
command, only PONG1 returned. Then if client sends something likeget something
, PONG2 returned.We need ability to flush the underlying buffer from server side, e.g
The underlying conn.wr.Flush() has been implemented. We just need to expose it on the Conn interface.
This feature is required when implementing the transaction feature like MULTI/EXEC, which will queue commands and execute at one submit.
Thank you!