This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new eaa1a04e0a [INLONG-8631][SDK] Handle context.Done() in Send() (#8632)
eaa1a04e0a is described below
commit eaa1a04e0ab0c7d009c024dce3fe3af7ce8b0bb6
Author: gunli <[email protected]>
AuthorDate: Sun Aug 6 15:55:49 2023 +0800
[INLONG-8631][SDK] Handle context.Done() in Send() (#8632)
Co-authored-by: gunli <[email protected]>
---
.../dataproxy-sdk-twins/dataproxy-sdk-golang/dataproxy/worker.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-golang/dataproxy/worker.go
b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-golang/dataproxy/worker.go
index 186a8e3be7..7edfc0c6dc 100755
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-golang/dataproxy/worker.go
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-golang/dataproxy/worker.go
@@ -301,8 +301,12 @@ func (w *worker) send(ctx context.Context, msg Message)
error {
}, true)
// wait for send done
- <-doneCh
- return err
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ case <-doneCh:
+ return err
+ }
}
func (w *worker) sendAsync(ctx context.Context, msg Message, callback
Callback) {