You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* loosen shutdown requirements to support things like go ctx
* clarify how to handle init/shutdown of providers bound to multiple names
* clarify that authors can await the READY event during init
Signed-off-by: Todd Baert <[email protected]>
Copy file name to clipboardexpand all lines: specification/sections/01-flag-evaluation.md
+8-5
Original file line number
Diff line number
Diff line change
@@ -39,15 +39,18 @@ See [provider](./02-providers.md) for details.
39
39
40
40
> The `provider mutator` function **MUST** invoke the `initialize` function on the newly registered provider before using it to resolve flag values.
41
41
42
+
Application authors can await the newly set `provider's` readiness using the `PROVIDER_READY` event.
43
+
Provider instances which are already active (because they have been bound to other `names` or otherwise) need not be initialized again.
42
44
The `provider's` readiness can state can be determined from its `status` member/accessor.
43
45
44
-
See [provider initialization](./02-providers.md#24-initialization).
46
+
See [event handlers and initialization](./05-events.md#event-handlers-and-initialization), [provider initialization](./02-providers.md#24-initialization).
45
47
46
48
#### Requirement 1.1.2.3
47
49
48
50
> The `provider mutator` function **MUST** invoke the `shutdown` function on the previously registered provider once it's no longer being used to resolve flag values.
49
51
50
-
Setting a new provider means the previous provider is no longer in use, and should therefore be disposed of using its `shutdown` function.
52
+
When a provider is no longer in use, it should be disposed of using its `shutdown` mechanism.
53
+
Provider instances which are bound to multiple names won't be shut down until the last binding is removed.
51
54
52
55
see: [shutdown](./02-providers.md#25-shutdown), [setting a provider](#setting-a-provider)
53
56
@@ -274,9 +277,9 @@ See [hooks](./04-hooks.md) for details.
274
277
275
278
#### Requirement 1.6.1
276
279
277
-
> The API **MUST** define a `shutdown` function which, when called, must call the respective `shutdown` function on the active provider.
280
+
> The API **MUST** define a mechanism to propagate a shutdown request to active providers.
278
281
279
-
The precise name of this function is not prescribed by this specification, but should be defined be the SDK.
280
-
Relevant language idioms should be considered when choosing the name for this function, in accordance with the resource-disposal semantics of the language in question.
282
+
The global API object might expose a `shutdown` function, which will call the respective `shutdown` function on the registered providers.
283
+
Alternatively, implementations might leverage language idioms such as auto-disposable interfaces or some means of cancellation signal propagation to allow for graceful shutdown.
@@ -249,6 +250,5 @@ class MyProvider implements Provider, AutoDisposable {
249
250
```
250
251
251
252
Providers may maintain remote connections, timers, threads or other constructs that need to be appropriately disposed of.
252
-
Provider authors may implement the `shutdown` function to perform relevant clean-up actions.
253
-
The precise name of this function is not prescribed by this specification, but should be defined be the SDK.
254
-
Relevant language idioms should be considered when choosing the name for this function, in accordance with the resource-disposal semantics of the language in question.
253
+
Provider authors may implement a `shutdown` function to perform relevant clean-up actions.
254
+
Alternatively, implementations might leverage language idioms such as auto-disposable interfaces or some means of cancellation signal propagation to allow for graceful shutdown.
0 commit comments