You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "rfyiamcool (via GitHub)" <gi...@apache.org> on 2023/10/19 04:13:41 UTC

[PR] fix: flush block [pulsar-client-go]

rfyiamcool opened a new pull request, #1104:
URL: https://github.com/apache/pulsar-client-go/pull/1104

   ### summary
   
   When the producer's close method is executed, the runEventsLoop coroutine will exit. If producer.flush is executed at this time, there is a possibility of blocking.
   
   `If you close first and then flush, `Flush()` will block.`
   
   ```
   go func() {
         close() := func() {
               close(internalQueue)
               producer.Close()
         }
   }()
   
   go func() {
         for _, msg := range internalQueue {
             producer.Send(...)
         }
         producer.Flush() // block
   }
   ```
   
   Sometimes, we cannot control the order of concurrent execution. 😁


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org