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

Add contexts to pubsub.Subscribe to allow early cancelation #1756

Merged
merged 1 commit into from
Jun 2, 2022

Commits on Jun 2, 2022

  1. Add contexts to pubsub.Subscribe to allow early cancelation

    This commit is related to dapr/dapr#4624. As noted there, we have an issue in the runtime where all components are shut down after the grace period, when the app is likely already stopped. Because of that, certain input components (the subscribe part of pubsub and the input part of bindings - the latter not in scope of this PR), can continue bringing new work when it's known to fail.
    
    In order to fix the issue linked above properly, we need to implement a way for PubSub components to have the "publish" part closed before the "subscribe" one (and in the future that will need to be done for input bindings too).
    
    This commit achieves precisely that by adding a context in the Subscribe method. When that context is canceled (which can be at any time), the subscription is removed.
    
    PS: This API change was implemented so it can one day be used for dapr/dapr#814 too, as it allows canceling individual subscriptions by using a different context. Although that's not possible today because it requires more work on the runtime, it does implement everything that's needed in the pubsub components already.
    Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
    ItalyPaleAle committed Jun 2, 2022
    Configuration menu
    Copy the full SHA
    c9f5c32 View commit details
    Browse the repository at this point in the history