Skip to content

Commit

Permalink
Merge pull request #676 from nats-io/js-opts-all
Browse files Browse the repository at this point in the history
Add optional JSOpts to management API
  • Loading branch information
wallyqs committed Mar 13, 2021
2 parents f44358c + 4b55d13 commit 18aff28
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 70 deletions.
8 changes: 7 additions & 1 deletion js.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,14 @@ func (sub *Subscription) Poll() error {
}

func (js *js) getConsumerInfo(stream, consumer string) (*ConsumerInfo, error) {
ctx, cancel := context.WithTimeout(context.Background(), js.opts.wait)
defer cancel()
return js.getConsumerInfoContext(ctx, stream, consumer)
}

func (js *js) getConsumerInfoContext(ctx context.Context, stream, consumer string) (*ConsumerInfo, error) {
ccInfoSubj := fmt.Sprintf(apiConsumerInfoT, stream, consumer)
resp, err := js.nc.Request(js.apiSubj(ccInfoSubj), nil, js.opts.wait)
resp, err := js.nc.RequestWithContext(ctx, js.apiSubj(ccInfoSubj), nil)
if err != nil {
if err == ErrNoResponders {
err = ErrJetStreamNotEnabled
Expand Down
Loading

0 comments on commit 18aff28

Please sign in to comment.