@nocobase/plugin-async-task-manager 2.0.0-beta.13 → 2.0.0-beta.14
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
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.0.0-beta.
|
|
11
|
+
"@nocobase/client": "2.0.0-beta.14",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/utils": "2.0.0-beta.
|
|
13
|
+
"@nocobase/utils": "2.0.0-beta.14",
|
|
14
14
|
"lodash": "4.17.21",
|
|
15
|
-
"@nocobase/server": "2.0.0-beta.
|
|
16
|
-
"@nocobase/logger": "2.0.0-beta.
|
|
17
|
-
"@nocobase/database": "2.0.0-beta.
|
|
15
|
+
"@nocobase/server": "2.0.0-beta.14",
|
|
16
|
+
"@nocobase/logger": "2.0.0-beta.14",
|
|
17
|
+
"@nocobase/database": "2.0.0-beta.14",
|
|
18
18
|
"antd": "5.24.2",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
20
|
"dayjs": "1.11.13",
|
|
21
|
-
"@nocobase/actions": "2.0.0-beta.
|
|
21
|
+
"@nocobase/actions": "2.0.0-beta.14"
|
|
22
22
|
};
|
|
@@ -107,6 +107,19 @@ class CommandTaskType extends import_task_type.TaskType {
|
|
|
107
107
|
const workerPath = import_path.default.resolve(import_node_process.default.cwd(), appRoot, isDev ? "src/index.ts" : "lib/index.js");
|
|
108
108
|
const workerPromise = new Promise((resolve, reject) => {
|
|
109
109
|
var _a2, _b;
|
|
110
|
+
let settled = false;
|
|
111
|
+
let successPayload;
|
|
112
|
+
const settleOnce = (err, payload) => {
|
|
113
|
+
if (settled) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
settled = true;
|
|
117
|
+
if (err) {
|
|
118
|
+
reject(err);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
resolve(payload);
|
|
122
|
+
};
|
|
110
123
|
try {
|
|
111
124
|
(_a2 = this.logger) == null ? void 0 : _a2.info(
|
|
112
125
|
`Creating worker for task ${this.record.id} - path: ${workerPath}, argv: ${JSON.stringify(
|
|
@@ -146,30 +159,30 @@ class CommandTaskType extends import_task_type.TaskType {
|
|
|
146
159
|
message.payload
|
|
147
160
|
)}`
|
|
148
161
|
);
|
|
149
|
-
|
|
162
|
+
successPayload = message.payload;
|
|
150
163
|
}
|
|
151
164
|
});
|
|
152
165
|
worker.on("error", (error) => {
|
|
153
166
|
var _a3;
|
|
154
167
|
(_a3 = this.logger) == null ? void 0 : _a3.error(`Worker error for task ${this.record.id}`, error);
|
|
155
|
-
|
|
168
|
+
settleOnce(error);
|
|
156
169
|
});
|
|
157
170
|
worker.on("exit", (code) => {
|
|
158
171
|
var _a3;
|
|
159
172
|
(_a3 = this.logger) == null ? void 0 : _a3.info(`Worker exited for task ${this.record.id} with code ${code}`);
|
|
160
173
|
if (isCancelling) {
|
|
161
|
-
|
|
174
|
+
settleOnce(new import_async_task_manager.CancelError());
|
|
162
175
|
} else if (code !== 0) {
|
|
163
|
-
|
|
176
|
+
settleOnce(new Error(`Worker stopped with exit code ${code}`));
|
|
164
177
|
} else {
|
|
165
|
-
|
|
178
|
+
settleOnce(null, successPayload ?? code);
|
|
166
179
|
}
|
|
167
180
|
});
|
|
168
181
|
worker.on("messageerror", (error) => {
|
|
169
|
-
|
|
182
|
+
settleOnce(error);
|
|
170
183
|
});
|
|
171
184
|
} catch (error) {
|
|
172
|
-
|
|
185
|
+
settleOnce(error);
|
|
173
186
|
}
|
|
174
187
|
});
|
|
175
188
|
return workerPromise;
|
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.0.0-beta.
|
|
9
|
+
"version": "2.0.0-beta.14",
|
|
10
10
|
"main": "dist/server/index.js",
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"@nocobase/client": "2.x",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"p-queue": "^6.6.2"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "e51bd3f094b93bd8bbb8fa3c6ff0f07fcca2e16d"
|
|
21
21
|
}
|