@nocobase/plugin-async-task-manager 1.9.38 → 1.9.40
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": "1.9.
|
|
11
|
+
"@nocobase/client": "1.9.40",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/utils": "1.9.
|
|
13
|
+
"@nocobase/utils": "1.9.40",
|
|
14
14
|
"lodash": "4.17.21",
|
|
15
|
-
"@nocobase/server": "1.9.
|
|
16
|
-
"@nocobase/logger": "1.9.
|
|
17
|
-
"@nocobase/database": "1.9.
|
|
15
|
+
"@nocobase/server": "1.9.40",
|
|
16
|
+
"@nocobase/logger": "1.9.40",
|
|
17
|
+
"@nocobase/database": "1.9.40",
|
|
18
18
|
"antd": "5.24.2",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
20
|
"dayjs": "1.11.13",
|
|
21
|
-
"@nocobase/actions": "1.9.
|
|
21
|
+
"@nocobase/actions": "1.9.40"
|
|
22
22
|
};
|
|
@@ -60,6 +60,19 @@ class CommandTaskType extends import_task_type.TaskType {
|
|
|
60
60
|
const workerPath = import_path.default.resolve(import_node_process.default.cwd(), appRoot, isDev ? "src/index.ts" : "lib/index.js");
|
|
61
61
|
const workerPromise = new Promise((resolve, reject) => {
|
|
62
62
|
var _a2, _b;
|
|
63
|
+
let settled = false;
|
|
64
|
+
let successPayload;
|
|
65
|
+
const settleOnce = (err, payload) => {
|
|
66
|
+
if (settled) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
settled = true;
|
|
70
|
+
if (err) {
|
|
71
|
+
reject(err);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
resolve(payload);
|
|
75
|
+
};
|
|
63
76
|
try {
|
|
64
77
|
(_a2 = this.logger) == null ? void 0 : _a2.info(
|
|
65
78
|
`Creating worker for task ${this.record.id} - path: ${workerPath}, argv: ${JSON.stringify(
|
|
@@ -97,30 +110,30 @@ class CommandTaskType extends import_task_type.TaskType {
|
|
|
97
110
|
message.payload
|
|
98
111
|
)}`
|
|
99
112
|
);
|
|
100
|
-
|
|
113
|
+
successPayload = message.payload;
|
|
101
114
|
}
|
|
102
115
|
});
|
|
103
116
|
worker.on("error", (error) => {
|
|
104
117
|
var _a3;
|
|
105
118
|
(_a3 = this.logger) == null ? void 0 : _a3.error(`Worker error for task ${this.record.id}`, error);
|
|
106
|
-
|
|
119
|
+
settleOnce(error);
|
|
107
120
|
});
|
|
108
121
|
worker.on("exit", (code) => {
|
|
109
122
|
var _a3;
|
|
110
123
|
(_a3 = this.logger) == null ? void 0 : _a3.info(`Worker exited for task ${this.record.id} with code ${code}`);
|
|
111
124
|
if (isCancelling) {
|
|
112
|
-
|
|
125
|
+
settleOnce(new import_async_task_manager.CancelError());
|
|
113
126
|
} else if (code !== 0) {
|
|
114
|
-
|
|
127
|
+
settleOnce(new Error(`Worker stopped with exit code ${code}`));
|
|
115
128
|
} else {
|
|
116
|
-
|
|
129
|
+
settleOnce(null, successPayload ?? code);
|
|
117
130
|
}
|
|
118
131
|
});
|
|
119
132
|
worker.on("messageerror", (error) => {
|
|
120
|
-
|
|
133
|
+
settleOnce(error);
|
|
121
134
|
});
|
|
122
135
|
} catch (error) {
|
|
123
|
-
|
|
136
|
+
settleOnce(error);
|
|
124
137
|
}
|
|
125
138
|
});
|
|
126
139
|
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": "1.9.
|
|
9
|
+
"version": "1.9.40",
|
|
10
10
|
"main": "dist/server/index.js",
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"@nocobase/client": "1.x",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"p-queue": "^6.6.2"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "853abfb8a77683e1e7afdc80be1d49ae1cb5d769"
|
|
21
21
|
}
|