merlimat commented on a change in pull request #108: [Issue #107] 
SetWriteDeadline on connection
URL: https://github.com/apache/pulsar-client-go/pull/108#discussion_r352739028
 
 

 ##########
 File path: pulsar/internal/connection.go
 ##########
 @@ -309,7 +310,13 @@ func (c *connection) WriteData(data []byte) {
 
 func (c *connection) internalWriteData(data []byte) {
        c.log.Debug("Write data: ", len(data))
-       if _, err := c.cnx.Write(data); err != nil {
+       err := c.cnx.SetWriteDeadline(time.Now().Add(writeDeadline))
 
 Review comment:
   Shouldn't this be set just once per each connection? doing it here would set 
it each time we write on the connection. 
   
   Also, since this will affect the publish timeouts, it would be better to 
keep it configurable (as a client option). 
   
   Finally, what is the exact meaning of the write deadline? Will it fail the 
write op if the connection is not writable for the specified amount of time? I 
think we are already covering this scenario with the keep-alive mechanism that 
detects either a clogged or stale TCP connection.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to