@nocobase/server 2.2.30 → 2.2.32
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/lib/application.d.ts +8 -0
- package/lib/application.js +15 -0
- package/package.json +17 -17
package/lib/application.d.ts
CHANGED
|
@@ -201,6 +201,14 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
|
|
|
201
201
|
static addCommand(callback: (app: Application) => void): void;
|
|
202
202
|
private _sqlLogger;
|
|
203
203
|
get instanceId(): number;
|
|
204
|
+
/**
|
|
205
|
+
* Adopt a worker id handed out at runtime, after the allocator loses its lease and acquires a different one. Ids may
|
|
206
|
+
* only be minted under a worker id this process currently holds, so the generator is rebuilt to match.
|
|
207
|
+
*
|
|
208
|
+
* Returning early on an unchanged id is required rather than an optimisation: rebuilding restarts the sequence at 0,
|
|
209
|
+
* so doing it for the same worker id inside one second would re-issue ids this process has already handed out.
|
|
210
|
+
*/
|
|
211
|
+
setInstanceId(instanceId: number): void;
|
|
204
212
|
get sqlLogger(): Logger;
|
|
205
213
|
protected _logger: SystemLogger;
|
|
206
214
|
get logger(): SystemLogger;
|
package/lib/application.js
CHANGED
|
@@ -154,6 +154,21 @@ const _Application = class _Application extends import_koa.default {
|
|
|
154
154
|
get instanceId() {
|
|
155
155
|
return this._instanceId;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Adopt a worker id handed out at runtime, after the allocator loses its lease and acquires a different one. Ids may
|
|
159
|
+
* only be minted under a worker id this process currently holds, so the generator is rebuilt to match.
|
|
160
|
+
*
|
|
161
|
+
* Returning early on an unchanged id is required rather than an optimisation: rebuilding restarts the sequence at 0,
|
|
162
|
+
* so doing it for the same worker id inside one second would re-issue ids this process has already handed out.
|
|
163
|
+
*/
|
|
164
|
+
setInstanceId(instanceId) {
|
|
165
|
+
if (this._instanceId === instanceId) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this._instanceId = instanceId;
|
|
169
|
+
this.snowflakeIdGenerator = new import_snowflake_id.Snowflake({ workerId: instanceId });
|
|
170
|
+
this.log.info(`adopt worker id: ${instanceId}`, { method: "setInstanceId" });
|
|
171
|
+
}
|
|
157
172
|
get sqlLogger() {
|
|
158
173
|
return this._sqlLogger;
|
|
159
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.32",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
"@koa/cors": "^5.0.0",
|
|
11
11
|
"@koa/multer": "^3.1.0",
|
|
12
12
|
"@koa/router": "^13.1.0",
|
|
13
|
-
"@nocobase/acl": "2.2.
|
|
14
|
-
"@nocobase/actions": "2.2.
|
|
15
|
-
"@nocobase/ai": "2.2.
|
|
16
|
-
"@nocobase/auth": "2.2.
|
|
17
|
-
"@nocobase/cache": "2.2.
|
|
18
|
-
"@nocobase/data-source-manager": "2.2.
|
|
19
|
-
"@nocobase/database": "2.2.
|
|
20
|
-
"@nocobase/evaluators": "2.2.
|
|
21
|
-
"@nocobase/lock-manager": "2.2.
|
|
22
|
-
"@nocobase/logger": "2.2.
|
|
23
|
-
"@nocobase/resourcer": "2.2.
|
|
24
|
-
"@nocobase/sdk": "2.2.
|
|
25
|
-
"@nocobase/snowflake-id": "2.2.
|
|
26
|
-
"@nocobase/telemetry": "2.2.
|
|
27
|
-
"@nocobase/utils": "2.2.
|
|
13
|
+
"@nocobase/acl": "2.2.32",
|
|
14
|
+
"@nocobase/actions": "2.2.32",
|
|
15
|
+
"@nocobase/ai": "2.2.32",
|
|
16
|
+
"@nocobase/auth": "2.2.32",
|
|
17
|
+
"@nocobase/cache": "2.2.32",
|
|
18
|
+
"@nocobase/data-source-manager": "2.2.32",
|
|
19
|
+
"@nocobase/database": "2.2.32",
|
|
20
|
+
"@nocobase/evaluators": "2.2.32",
|
|
21
|
+
"@nocobase/lock-manager": "2.2.32",
|
|
22
|
+
"@nocobase/logger": "2.2.32",
|
|
23
|
+
"@nocobase/resourcer": "2.2.32",
|
|
24
|
+
"@nocobase/sdk": "2.2.32",
|
|
25
|
+
"@nocobase/snowflake-id": "2.2.32",
|
|
26
|
+
"@nocobase/telemetry": "2.2.32",
|
|
27
|
+
"@nocobase/utils": "2.2.32",
|
|
28
28
|
"@types/ini": "^1.3.31",
|
|
29
29
|
"@types/koa-send": "^4.1.3",
|
|
30
30
|
"@types/multer": "^1.4.12",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"@types/serve-handler": "^6.1.1",
|
|
61
61
|
"@types/ws": "^8.5.5"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "04fa0d6f0fbc637f59a1c8a40a7ce038e13d267c"
|
|
64
64
|
}
|