Skip to content

Commit 7a89580

Browse files
update
1 parent 4faf4f8 commit 7a89580

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

examples/refresh.mjs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,18 @@ const settings = await load(connectionString, {
2626
refreshOptions: {
2727
enabled: true,
2828
watchedSettings: [{ key: "app.settings.sentinel" }],
29-
refreshIntervalInMs: 10 * 1000 // Default value is 30 seconds, shorted for this sample
29+
refreshIntervalInMs: 10_000 // Default value is 30 seconds, shorted for this sample
3030
}
3131
});
3232

3333
console.log("Using Azure portal or CLI, update the `app.settings.message` value, and then update the `app.settings.sentinel` value in your App Configuration store.")
3434

3535
// eslint-disable-next-line no-constant-condition
3636
while (true) {
37-
// Refreshing the configuration setting
38-
await settings.refresh();
39-
4037
// Current value of message
4138
console.log(settings.get("message"));
42-
43-
// Waiting before the next refresh
44-
await sleepInMs(5000);
39+
// Refreshing the configuration setting asynchronously
40+
settings.refresh();
41+
// wait for 5 seconds
42+
await sleepInMs(5_000);
4543
}

examples/server.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const PORT = 3000;
2727
server.use(express.json());
2828

2929
// Use a middleware to achieve request-driven configuration refresh
30+
// For more information, please go to dynamic refresh tutorial: https://learn.microsoft.com/azure/azure-app-configuration/enable-dynamic-configuration-javascript
3031
server.use((req, res, next) => {
3132
// this call s not blocking, the configuration will be updated asynchronously
3233
appConfig.refresh();

src/common/disposable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export class Disposable {
1515
}
1616
this.#disposed = true;
1717
}
18-
}
18+
}

0 commit comments

Comments
 (0)