Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js: Fix context usage with sub.Fetch #838

Merged
merged 1 commit into from Oct 5, 2021
Merged

js: Fix context usage with sub.Fetch #838

merged 1 commit into from Oct 5, 2021

Commits on Oct 5, 2021

  1. js: Fix context usage with sub.Fetch and msg.Ack

    The deadline of a context is now used to calculate
    the time used for `expires` instead of the default `ttl`
    of the JetStream context which was 5s.  This was preventing
    library users from passing a context with a custom timeout.
    
    This also disallows the usage of `context.Background`
    to make it explicit that `sub.Fetch` has to be used
    with a context that has a timeout since each fetch
    request has to include an expire time anyway.
    
    In case `context.WithCancel` is used, then a child context
    with the same duration as the JetStream context default
    timeout will be created.
    
    Also in case msg.Ack it was possible to pass both timeout
    and a context which would have been ambiguous and only
    context option being used.
    
    Signed-off-by: Waldemar Quevedo <wally@synadia.com>
    wallyqs committed Oct 5, 2021
    Copy the full SHA
    8f86c1d View commit details
    Browse the repository at this point in the history