keryx 0.24.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/classes/API.ts +5 -5
- package/package.json +1 -1
package/classes/API.ts
CHANGED
|
@@ -18,8 +18,6 @@ export enum RUN_MODE {
|
|
|
18
18
|
SERVER = "server",
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
let flapPreventer = false;
|
|
22
|
-
|
|
23
21
|
/**
|
|
24
22
|
* The global singleton that manages the full framework lifecycle: initialize → start → stop.
|
|
25
23
|
* All initializers attach their namespaces to this object (e.g., `api.db`, `api.actions`, `api.redis`).
|
|
@@ -44,6 +42,8 @@ export class API {
|
|
|
44
42
|
runMode!: RUN_MODE;
|
|
45
43
|
/** All discovered initializer instances, topologically sorted by `dependsOn` after discovery. */
|
|
46
44
|
initializers: Initializer[];
|
|
45
|
+
/** Guards `restart()` against concurrent re-entry so rapid stop/start cycles get coalesced. */
|
|
46
|
+
private flapPreventer = false;
|
|
47
47
|
|
|
48
48
|
// allow arbitrary properties to be set on the API, to be added and typed later
|
|
49
49
|
[key: string]: any;
|
|
@@ -184,12 +184,12 @@ export class API {
|
|
|
184
184
|
* concurrent restart calls to avoid rapid stop/start cycles.
|
|
185
185
|
*/
|
|
186
186
|
async restart() {
|
|
187
|
-
if (flapPreventer) return;
|
|
187
|
+
if (this.flapPreventer) return;
|
|
188
188
|
|
|
189
|
-
flapPreventer = true;
|
|
189
|
+
this.flapPreventer = true;
|
|
190
190
|
await this.stop();
|
|
191
191
|
await this.start();
|
|
192
|
-
flapPreventer = false;
|
|
192
|
+
this.flapPreventer = false;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
private async loadLocalConfig() {
|