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
Creates a lightweight watcher that refreshes the config value in the background (currently every 60 seconds). Useful for long‑lived processes wanting near‑real‑time updates without manually refetching.
100
+
Creates a lightweight watcher that refreshes the config value in the background (every 60 seconds). Useful for long‑lived processes wanting near‑real‑time updates without manually refetching.
105
101
106
102
Returns a promise resolving to an object: `{ get(): T, close(): void }`.
107
103
108
-
-`get()` – returns the most recent value (initially the provided fallback until the first successful fetch).
104
+
-`get()` – returns the most recent value.
109
105
-`close()` – stops the periodic refresh for just this watcher. Further calls to `get()` after `close()` throw.
110
106
111
-
Errors during refresh reuse the last known value.
107
+
Notes:
108
+
109
+
- The initial fetch must succeed (it will throw on errors).
110
+
- Subsequent periodic refreshes update the stored value on success.
112
111
113
112
#### Watcher lifecycle
114
113
@@ -119,10 +118,7 @@ Errors during refresh reuse the last known value.
This SDK doesn't throw on request/response errors during `getConfigValue` or background refreshes in`watchConfigValue`. Instead, it logs (using the provided or default logger) and returns the provided `fallback` (or previous value for watchers).
140
+
`getConfigValue` throws on non‑2xx HTTP responses (including 404), network errors, and invalid JSON.`watchConfigValue` uses `getConfigValue` for its initial fetch; handle errors accordingly with try/catch when creating a watcher. A `ReplaneError` is thrown for HTTP failures; other errors may be thrown for network/parse issues.
0 commit comments