Skip to content

Commit

Permalink
propagate context to upsertConsumer
Browse files Browse the repository at this point in the history
Signed-off-by: Rene Kaufmann <kaufmann.r@gmail.com>
  • Loading branch information
HeavyHorst committed Oct 18, 2023
1 parent ff131ad commit a1c035f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js.go
Expand Up @@ -1727,7 +1727,13 @@ func (js *js) subscribe(subj, queue string, cb MsgHandler, ch chan *Msg, isSync,
} else if consName == "" {
consName = getHash(nuid.Next())
}
info, err := js.upsertConsumer(stream, consName, ccreq.Config)

opts := make([]JSOpt, 0, 1)
if ctx != nil {
opts = append(opts, Context(ctx))
}

info, err := js.upsertConsumer(stream, consName, ccreq.Config, opts...)
if err != nil {
var apiErr *APIError
if ok := errors.As(err, &apiErr); !ok {
Expand Down

0 comments on commit a1c035f

Please sign in to comment.