nodece commented on code in PR #1338:
URL: https://github.com/apache/pulsar-client-go/pull/1338#discussion_r1969801854


##########
pulsar/internal/connection.go:
##########
@@ -530,7 +554,7 @@ func (c *connection) writeCommand(cmd *pb.BaseCommand) {
        }
 
        c.writeBuffer.WrittenBytes(cmdSize)
-       c.internalWriteData(c.writeBuffer)
+       c.internalWriteData(nil, c.writeBuffer)

Review Comment:
   ```suggestion
        c.internalWriteData(context.Background(), c.writeBuffer)
   ```



##########
pulsar/internal/connection.go:
##########
@@ -501,11 +511,25 @@ func (c *connection) WriteData(data Buffer) {
 
 }
 
-func (c *connection) internalWriteData(data Buffer) {
+func (c *connection) internalWriteData(ctx context.Context, data Buffer) {
        c.log.Debug("Write data: ", data.ReadableBytes())
-       if _, err := c.cnx.Write(data.ReadableSlice()); err != nil {
-               c.log.WithError(err).Warn("Failed to write on connection")
-               c.Close()
+       if ctx == nil {
+               if _, err := c.cnx.Write(data.ReadableSlice()); err != nil {
+                       c.log.WithError(err).Warn("Failed to write on 
connection")
+                       c.Close()
+               }
+
+               return
+       }
+

Review Comment:
   ```suggestion
   ```
   Unnecessary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to