@tachybase/module-worker-thread 1.3.11 → 1.3.12
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/dist/externalVersion.js +10 -10
- package/dist/server/intercept.js +4 -5
- package/dist/server/plugin.js +5 -5
- package/dist/server/worker.js +4 -0
- package/dist/server/workerManager.js +7 -5
- package/package.json +13 -13
- package/worker-starter.js +8 -0
- package/worker-starter.mjs +0 -8
package/dist/externalVersion.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.3.
|
|
4
|
-
"@tachybase/schema": "1.3.
|
|
3
|
+
"@tachybase/client": "1.3.12",
|
|
4
|
+
"@tachybase/schema": "1.3.12",
|
|
5
5
|
"antd": "5.22.5",
|
|
6
|
-
"@tachybase/globals": "1.3.
|
|
7
|
-
"@tachybase/loader": "1.3.
|
|
8
|
-
"@tachybase/server": "1.3.
|
|
9
|
-
"@tachybase/logger": "1.3.
|
|
10
|
-
"@tachybase/module-collection": "1.3.
|
|
11
|
-
"@tachybase/module-user": "1.3.
|
|
12
|
-
"@tachybase/utils": "1.3.
|
|
13
|
-
"@tachybase/actions": "1.3.
|
|
6
|
+
"@tachybase/globals": "1.3.12",
|
|
7
|
+
"@tachybase/loader": "1.3.12",
|
|
8
|
+
"@tachybase/server": "1.3.12",
|
|
9
|
+
"@tachybase/logger": "1.3.12",
|
|
10
|
+
"@tachybase/module-collection": "1.3.12",
|
|
11
|
+
"@tachybase/module-user": "1.3.12",
|
|
12
|
+
"@tachybase/utils": "1.3.12",
|
|
13
|
+
"@tachybase/actions": "1.3.12"
|
|
14
14
|
};
|
package/dist/server/intercept.js
CHANGED
|
@@ -24,11 +24,10 @@ var import_node_module = require("node:module");
|
|
|
24
24
|
var import_node_worker_threads = require("node:worker_threads");
|
|
25
25
|
var import_globals = __toESM(require("@tachybase/globals"));
|
|
26
26
|
var import_loader = require("@tachybase/loader");
|
|
27
|
-
|
|
28
|
-
import_globals.default.getInstance(
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const whitelists = new Set(process.env.TACHYBASE_WORKER_MODULES.split(","));
|
|
27
|
+
if (!import_node_worker_threads.isMainThread) {
|
|
28
|
+
const globals = import_globals.default.getInstance(import_node_worker_threads.workerData.initData);
|
|
29
|
+
const lookingPaths = globals.get("WORKER_PATHS");
|
|
30
|
+
const whitelists = new Set(globals.get("WORKER_MODULES"));
|
|
32
31
|
const originalLoad = import_node_module.Module._load;
|
|
33
32
|
import_node_module.Module._load = (0, import_loader.defineLoader)(whitelists, originalLoad, lookingPaths);
|
|
34
33
|
}
|
package/dist/server/plugin.js
CHANGED
|
@@ -66,7 +66,7 @@ __export(plugin_exports, {
|
|
|
66
66
|
default: () => plugin_default
|
|
67
67
|
});
|
|
68
68
|
module.exports = __toCommonJS(plugin_exports);
|
|
69
|
-
var
|
|
69
|
+
var import_node_worker_threads = require("node:worker_threads");
|
|
70
70
|
var import_server = require("@tachybase/server");
|
|
71
71
|
var import_constants = require("../constants");
|
|
72
72
|
var import_constants2 = require("./constants");
|
|
@@ -80,12 +80,12 @@ class ModuleWorkerThreadServer extends (_a = import_server.Plugin) {
|
|
|
80
80
|
async afterAdd() {
|
|
81
81
|
}
|
|
82
82
|
async beforeLoad() {
|
|
83
|
-
if (!
|
|
83
|
+
if (!import_node_worker_threads.isMainThread) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
async load() {
|
|
88
|
-
if (!
|
|
88
|
+
if (!import_node_worker_threads.isMainThread) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
const workerCount = this.app.name === "main" ? import_constants2.WORKER_COUNT : import_constants2.WORKER_COUNT_SUB;
|
|
@@ -98,7 +98,7 @@ class ModuleWorkerThreadServer extends (_a = import_server.Plugin) {
|
|
|
98
98
|
});
|
|
99
99
|
this.app.on("beforeStop", async () => {
|
|
100
100
|
var _a2;
|
|
101
|
-
if (!
|
|
101
|
+
if (!import_node_worker_threads.isMainThread) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
if ((_a2 = this.app.worker) == null ? void 0 : _a2.available) {
|
|
@@ -115,7 +115,7 @@ class ModuleWorkerThreadServer extends (_a = import_server.Plugin) {
|
|
|
115
115
|
async afterEnable() {
|
|
116
116
|
}
|
|
117
117
|
async afterDisable() {
|
|
118
|
-
if (!
|
|
118
|
+
if (!import_node_worker_threads.isMainThread) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
await this.app.worker.clear();
|
package/dist/server/worker.js
CHANGED
|
@@ -32,12 +32,16 @@ __export(worker_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(worker_exports);
|
|
33
33
|
var import_intercept = require("./intercept");
|
|
34
34
|
var import_node_worker_threads = require("node:worker_threads");
|
|
35
|
+
var import_globals = __toESM(require("@tachybase/globals"));
|
|
35
36
|
var import_logger = require("@tachybase/logger");
|
|
36
37
|
var import_module_collection = __toESM(require("@tachybase/module-collection"));
|
|
37
38
|
var import_module_user = __toESM(require("@tachybase/module-user"));
|
|
38
39
|
var import_server = require("@tachybase/server");
|
|
39
40
|
var import_utils = require("@tachybase/utils");
|
|
40
41
|
var import_workerTypes = require("./workerTypes");
|
|
42
|
+
if (!import_node_worker_threads.isMainThread) {
|
|
43
|
+
const globals = import_globals.default.getInstance(import_node_worker_threads.workerData.initData);
|
|
44
|
+
}
|
|
41
45
|
const loggerOptions = {
|
|
42
46
|
system: {
|
|
43
47
|
transports: (0, import_logger.getLoggerTransport)(),
|
|
@@ -32,8 +32,8 @@ __export(workerManager_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(workerManager_exports);
|
|
33
33
|
var import_node_crypto = require("node:crypto");
|
|
34
34
|
var import_node_path = __toESM(require("node:path"));
|
|
35
|
-
var import_node_url = require("node:url");
|
|
36
35
|
var import_node_worker_threads = require("node:worker_threads");
|
|
36
|
+
var import_globals = __toESM(require("@tachybase/globals"));
|
|
37
37
|
var import_utils = require("@tachybase/utils");
|
|
38
38
|
var import_constants = require("./constants");
|
|
39
39
|
var import_workerTypes = require("./workerTypes");
|
|
@@ -101,7 +101,8 @@ const _WorkerManager = class _WorkerManager {
|
|
|
101
101
|
worker = new import_node_worker_threads.Worker(import_node_path.default.resolve(__dirname, `${import_constants.WORKER_FILE}.js`), {
|
|
102
102
|
workerData: {
|
|
103
103
|
appName: this.app.name,
|
|
104
|
-
databaseOptions: this.databaseOptions
|
|
104
|
+
databaseOptions: this.databaseOptions,
|
|
105
|
+
initData: import_globals.default.getInstance().toJSON()
|
|
105
106
|
},
|
|
106
107
|
env: {
|
|
107
108
|
...process.env,
|
|
@@ -109,11 +110,12 @@ const _WorkerManager = class _WorkerManager {
|
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
} else {
|
|
112
|
-
worker = new import_node_worker_threads.Worker(import_node_path.default.resolve(__dirname, "../../worker-starter.
|
|
113
|
+
worker = new import_node_worker_threads.Worker(import_node_path.default.resolve(__dirname, "../../worker-starter.js"), {
|
|
113
114
|
workerData: {
|
|
114
|
-
scriptPath:
|
|
115
|
+
scriptPath: import_node_path.default.resolve(__dirname, `${import_constants.WORKER_FILE}.ts`),
|
|
115
116
|
appName: this.app.name,
|
|
116
|
-
databaseOptions: this.databaseOptions
|
|
117
|
+
databaseOptions: this.databaseOptions,
|
|
118
|
+
initData: import_globals.default.getInstance().toJSON()
|
|
117
119
|
},
|
|
118
120
|
env: {
|
|
119
121
|
...process.env,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-worker-thread",
|
|
3
3
|
"displayName": "Worker thread",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.12",
|
|
5
5
|
"description": "Worker thread for executing time-consuming tasks",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Workflow"
|
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
"dependencies": {},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"antd": "5.22.5",
|
|
13
|
-
"tsx": "
|
|
13
|
+
"tsx": "4.20.3"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@tachybase/
|
|
17
|
-
"@tachybase/
|
|
18
|
-
"@tachybase/loader": "1.3.
|
|
19
|
-
"@tachybase/
|
|
20
|
-
"@tachybase/
|
|
21
|
-
"@tachybase/
|
|
22
|
-
"@tachybase/module-
|
|
23
|
-
"@tachybase/schema": "1.3.
|
|
24
|
-
"@tachybase/server": "1.3.
|
|
25
|
-
"@tachybase/test": "1.3.
|
|
26
|
-
"@tachybase/utils": "1.3.
|
|
16
|
+
"@tachybase/client": "1.3.12",
|
|
17
|
+
"@tachybase/globals": "1.3.12",
|
|
18
|
+
"@tachybase/loader": "1.3.12",
|
|
19
|
+
"@tachybase/actions": "1.3.12",
|
|
20
|
+
"@tachybase/logger": "1.3.12",
|
|
21
|
+
"@tachybase/module-user": "1.3.12",
|
|
22
|
+
"@tachybase/module-collection": "1.3.12",
|
|
23
|
+
"@tachybase/schema": "1.3.12",
|
|
24
|
+
"@tachybase/server": "1.3.12",
|
|
25
|
+
"@tachybase/test": "1.3.12",
|
|
26
|
+
"@tachybase/utils": "1.3.12"
|
|
27
27
|
},
|
|
28
28
|
"description.zh-CN": "工作线程,用于执行耗时任务",
|
|
29
29
|
"displayName.zh-CN": "工作线程",
|