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 Close() error to bindings #779

Closed
pkedy opened this issue Mar 26, 2021 · 1 comment
Closed

Add Close() error to bindings #779

pkedy opened this issue Mar 26, 2021 · 1 comment
Labels
area/runtime/binding good first issue Good for newcomers kind/enhancement New feature or request P1 size/S 1 week of work

Comments

@pkedy
Copy link
Member

pkedy commented Mar 26, 2021

Currently, the PubSub interface contains a Closer() error function so that the component can cleanly shutdown when daprd is stopped. This does not exist in bindings and that has resulted in binding implementations are having to use signal.Notify in order to stop a subscription, etc.

Instead, PubSub and Binding interfaces could embed io.Closer. Many of the pubsub components have moved to using an internal content.Context for backoff/timeout purposes. The Close method should call the cancel func returned by context.WithCancel in order to idiomatically shutdown goroutines, etc.

This likely involves a change to dapr/dapr (most likely in runtime.go) to invoke Close on shutdown. It's also possible for components to optionally implement io.Closer so long as daprd checks for that and invokes accordingly. Our documentation on how to build a component would just need to make that clear.

@pkedy
Copy link
Member Author

pkedy commented May 27, 2021

This was resolved in dapr/dapr. Opening new issues for each component as I run into "interrupt signal" based cleanup logic.

@pkedy pkedy closed this as completed May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runtime/binding good first issue Good for newcomers kind/enhancement New feature or request P1 size/S 1 week of work
Projects
None yet
Development

No branches or pull requests

2 participants