Skip to content

[Question] API.shutdown() required in Go? #189

@toddbaert

Description

@toddbaert

1.6.1 requires an API.shutdown() function. After a few discussions with contributors I'm not 100% sure this is necessary, particularly for Go.

The purpose of the API.shutdown() function is for providing a means to initiate a graceful shutdown. For example, in Java, you'd catch a SIGINT in your Java app, and then that handler would call API.Shutdown() to cleanup all the polling, DB connections, workers, and flush telemetry or whatever other cleanup providers need done.

However in Go, the Context provides some of this functionality. A better pattern for Go might be to create a provider with a NewMyProvider function (which the provider author defines) which takes Context. That provider listens for ctx.done() and handles their own shutdown. Application authors simply emit the cancellation event and everything is cleaned up.

We may want to relax 1.6.1m making it a "MAY" instead of a "MUST", and add some non-normative text like:

Implementations can choose to leverage language idioms such as auto-disposable interfaces and other means of cancellation signal propagation to allow for graceful shutdown.

@open-feature/sdk-golang-approvers @open-feature/sdk-golang-maintainers

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions