@tachybase/module-worker-thread 0.23.41 → 0.23.48

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.
@@ -1,12 +1,12 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "0.23.41",
4
- "@tachybase/schema": "0.23.41",
3
+ "@tachybase/client": "0.23.48",
4
+ "@tachybase/schema": "0.23.48",
5
5
  "antd": "5.22.5",
6
- "@tachybase/server": "0.23.41",
7
- "@tachybase/logger": "0.23.41",
8
- "@tachybase/module-collection": "0.23.41",
9
- "@tachybase/module-user": "0.23.41",
10
- "@tachybase/utils": "0.23.41",
11
- "@tachybase/actions": "0.23.41"
6
+ "@tachybase/server": "0.23.48",
7
+ "@tachybase/logger": "0.23.48",
8
+ "@tachybase/module-collection": "0.23.48",
9
+ "@tachybase/module-user": "0.23.48",
10
+ "@tachybase/utils": "0.23.48",
11
+ "@tachybase/actions": "0.23.48"
12
12
  };
@@ -48,9 +48,17 @@ function copyBasicTypes(obj) {
48
48
  }
49
49
  return result;
50
50
  }
51
- class WorkerManager {
51
+ const _WorkerManager = class _WorkerManager {
52
52
  constructor(app, workerNum) {
53
53
  this.app = app;
54
+ this.isProd = true;
55
+ this.workerNum = 0;
56
+ this.workerList = [];
57
+ this.currentWorkerIndex = 0;
58
+ this.busyWorkers = /* @__PURE__ */ new WeakMap();
59
+ this.busyWorkerSet = /* @__PURE__ */ new Set();
60
+ this.cache = /* @__PURE__ */ new Map();
61
+ this.errorRecoveryTimes = 0;
54
62
  if (!import_worker_threads.isMainThread) {
55
63
  return;
56
64
  }
@@ -62,23 +70,12 @@ class WorkerManager {
62
70
  get available() {
63
71
  return this.workerList.length > 0;
64
72
  }
65
- isProd = true;
66
- workerNum = 0;
67
- workerList = [];
68
- currentWorkerIndex = 0;
69
- busyWorkers = /* @__PURE__ */ new WeakMap();
70
- busyWorkerSet = /* @__PURE__ */ new Set();
71
- cache = /* @__PURE__ */ new Map();
72
- errorRecoveryTimes = 0;
73
- // 默认超时时间
74
- static timeoutSecond = import_constants.WORKER_TIMEOUT;
75
73
  getPluginMethodKey(values) {
76
74
  return `worker:pluginMethod:${values.plugin}:${values.method}`;
77
75
  }
78
76
  getGlobalKey() {
79
77
  return `worker:global`;
80
78
  }
81
- databaseOptions;
82
79
  getPresetWorkerNum() {
83
80
  return this.workerNum;
84
81
  }
@@ -201,7 +198,7 @@ class WorkerManager {
201
198
  let countInfo = cache.get(key);
202
199
  if (countInfo && countInfo.lastTime) {
203
200
  const diff = now - countInfo.lastTime.getTime();
204
- if (diff > 1e3 * WorkerManager.timeoutSecond) {
201
+ if (diff > 1e3 * _WorkerManager.timeoutSecond) {
205
202
  countInfo.count = 0;
206
203
  this.app.logger.debug(`[worker] Reset concurrency count for ${key} due to timeout`);
207
204
  }
@@ -357,7 +354,7 @@ class WorkerManager {
357
354
  new Error("callPluginMethod timed out")
358
355
  );
359
356
  },
360
- (values.timeoutSecond || WorkerManager.timeoutSecond) * 1e3
357
+ (values.timeoutSecond || _WorkerManager.timeoutSecond) * 1e3
361
358
  );
362
359
  worker.on("message", handleMessage);
363
360
  worker.on("error", handleError);
@@ -369,7 +366,10 @@ class WorkerManager {
369
366
  });
370
367
  });
371
368
  }
372
- }
369
+ };
370
+ // 默认超时时间
371
+ _WorkerManager.timeoutSecond = import_constants.WORKER_TIMEOUT;
372
+ let WorkerManager = _WorkerManager;
373
373
  // Annotate the CommonJS export names for ESM import in node:
374
374
  0 && (module.exports = {
375
375
  WorkerManager
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/module-worker-thread",
3
- "version": "0.23.41",
3
+ "version": "0.23.48",
4
4
  "description": "Worker thread for executing time-consuming tasks",
5
5
  "main": "dist/server/index.js",
6
6
  "dependencies": {},
@@ -9,15 +9,15 @@
9
9
  "tsx": "^4.19.2"
10
10
  },
11
11
  "peerDependencies": {
12
- "@tachybase/actions": "0.23.41",
13
- "@tachybase/client": "0.23.41",
14
- "@tachybase/module-collection": "0.23.41",
15
- "@tachybase/logger": "0.23.41",
16
- "@tachybase/server": "0.23.41",
17
- "@tachybase/schema": "0.23.41",
18
- "@tachybase/test": "0.23.41",
19
- "@tachybase/utils": "0.23.41",
20
- "@tachybase/module-user": "0.23.41"
12
+ "@tachybase/actions": "0.23.48",
13
+ "@tachybase/client": "0.23.48",
14
+ "@tachybase/logger": "0.23.48",
15
+ "@tachybase/module-user": "0.23.48",
16
+ "@tachybase/server": "0.23.48",
17
+ "@tachybase/schema": "0.23.48",
18
+ "@tachybase/module-collection": "0.23.48",
19
+ "@tachybase/test": "0.23.48",
20
+ "@tachybase/utils": "0.23.48"
21
21
  },
22
22
  "description.zh-CN": "工作线程,用于执行耗时任务",
23
23
  "displayName.zh-CN": "工作线程",