@nocobase/plugin-async-task-manager 2.1.0-alpha.9 → 2.1.0-beta.10

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.
@@ -8,15 +8,15 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.9",
11
+ "@nocobase/client": "2.1.0-beta.10",
12
12
  "react": "18.2.0",
13
- "@nocobase/utils": "2.1.0-alpha.9",
13
+ "@nocobase/utils": "2.1.0-beta.10",
14
14
  "lodash": "4.17.21",
15
- "@nocobase/server": "2.1.0-alpha.9",
16
- "@nocobase/logger": "2.1.0-alpha.9",
17
- "@nocobase/database": "2.1.0-alpha.9",
15
+ "@nocobase/server": "2.1.0-beta.10",
16
+ "@nocobase/logger": "2.1.0-beta.10",
17
+ "@nocobase/database": "2.1.0-beta.10",
18
18
  "antd": "5.24.2",
19
19
  "react-i18next": "11.18.6",
20
20
  "dayjs": "1.11.13",
21
- "@nocobase/actions": "2.1.0-alpha.9"
21
+ "@nocobase/actions": "2.1.0-beta.10"
22
22
  };
@@ -109,6 +109,7 @@ class CommandTaskType extends import_task_type.TaskType {
109
109
  var _a2, _b;
110
110
  let settled = false;
111
111
  let successPayload;
112
+ let failurePayload;
112
113
  const settleOnce = (err, payload) => {
113
114
  if (settled) {
114
115
  return;
@@ -148,7 +149,7 @@ class CommandTaskType extends import_task_type.TaskType {
148
149
  worker.terminate();
149
150
  });
150
151
  worker.on("message", (message) => {
151
- var _a3, _b2;
152
+ var _a3, _b2, _c, _d;
152
153
  (_a3 = this.logger) == null ? void 0 : _a3.trace(`Worker message received for task ${this.record.id} - type: ${message.type}`);
153
154
  if (message.type === "progress") {
154
155
  this.reportProgress(message.payload);
@@ -161,6 +162,10 @@ class CommandTaskType extends import_task_type.TaskType {
161
162
  );
162
163
  successPayload = message.payload;
163
164
  }
165
+ if (message.type === "failure") {
166
+ (_d = this.logger) == null ? void 0 : _d.error(`Worker failure for task ${this.record.id} `, (_c = message.payload) == null ? void 0 : _c.error);
167
+ failurePayload = message.payload;
168
+ }
164
169
  });
165
170
  worker.on("error", (error) => {
166
171
  var _a3;
@@ -173,7 +178,7 @@ class CommandTaskType extends import_task_type.TaskType {
173
178
  if (isCancelling) {
174
179
  settleOnce(new import_async_task_manager.CancelError());
175
180
  } else if (code !== 0) {
176
- settleOnce(new Error(`Worker stopped with exit code ${code}`));
181
+ settleOnce((failurePayload == null ? void 0 : failurePayload.error) ?? new Error(`Worker stopped with exit code ${code}`));
177
182
  } else {
178
183
  settleOnce(null, successPayload ?? code);
179
184
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Manage and monitor asynchronous tasks such as data import/export. Support task progress tracking and notification.",
7
7
  "description.ru-RU": "Управление асинхронными задачами и мониторинг (например, импорт/экспорт данных). Поддержка отслеживания прогресса и уведомлений о задачах.",
8
8
  "description.zh-CN": "管理和监控数据导入导出等异步任务。支持任务进度跟踪和通知。",
9
- "version": "2.1.0-alpha.9",
9
+ "version": "2.1.0-beta.10",
10
10
  "main": "dist/server/index.js",
11
11
  "peerDependencies": {
12
12
  "@nocobase/client": "2.x",
@@ -18,5 +18,5 @@
18
18
  "p-queue": "^6.6.2"
19
19
  },
20
20
  "license": "Apache-2.0",
21
- "gitHead": "f9c6c53772bd5002fa419188d15ab227224f1962"
21
+ "gitHead": "f7e467710d4748f7089b779494b220025b39bc02"
22
22
  }