streamnativebot opened a new pull request, #1420: URL: https://github.com/apache/pulsar-client-go/pull/1420
## Summary The async producer was not honoring the context passed to SendAsync, which violated Go's context conventions. When the Pulsar broker connection was lost, the producer would continue attempting to send messages indefinitely, ignoring context cancellation and SendTimeout settings. ## Changes - Check context cancellation in the event loop before processing send requests - Check context before processing internalSend - Use the original request context when writing data instead of creating new one - Add context checking in clearPendingSendRequests - Add test to verify context cancellation is respected ## Motivation This issue was reported by RudderStack in streamnative/eng-support-tickets#3170. In Go, all functions and methods that receive a context must honor it. The current implementation stores the context in the sendRequest but never checks if it's canceled, causing the producer to hang indefinitely when the broker connection is lost. ## Testing Added test that verifies the producer respects context cancellation when messages are queued but cannot be sent. ## Related Issues - Fixes streamnative/eng-support-tickets#3170 🤖 Generated with [Claude Code](https://claude.ai/code) -- 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]
