Skip to content

Commit

Permalink
[INLONG-8631][SDK] Handle context.Done() in Send() (#8632)
Browse files Browse the repository at this point in the history
Co-authored-by: gunli <[email protected]>
  • Loading branch information
gunli and gunli authored Aug 6, 2023
1 parent 8012151 commit eaa1a04
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit eaa1a04

Please sign in to comment.