oak-backend-base 4.1.13 → 4.1.15
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/lib/AppLoader.js +4 -1
- package/lib/Synchronizer.js +13 -7
- package/package.json +4 -4
package/lib/AppLoader.js
CHANGED
|
@@ -371,7 +371,10 @@ class AppLoader extends types_1.AppLoader {
|
|
|
371
371
|
count++;
|
|
372
372
|
const start = Date.now();
|
|
373
373
|
for (const w of totalWatchers) {
|
|
374
|
-
|
|
374
|
+
/**
|
|
375
|
+
* todo 原来这里是所有的watcher并行,会产生死锁,先改成串行,后续再优化
|
|
376
|
+
*/
|
|
377
|
+
await execOne(w, start);
|
|
375
378
|
}
|
|
376
379
|
const duration = Date.now() - start;
|
|
377
380
|
console.log(`第${count}次执行watchers,共执行${watchers.length}个,耗时${duration}毫秒`);
|
package/lib/Synchronizer.js
CHANGED
|
@@ -144,7 +144,7 @@ class Synchronizer {
|
|
|
144
144
|
}
|
|
145
145
|
}, {});
|
|
146
146
|
const entityIds = operEntityArr.map(ele => ele.entityId);
|
|
147
|
-
|
|
147
|
+
await onSynchronized({
|
|
148
148
|
action: oper.action,
|
|
149
149
|
data: oper.data,
|
|
150
150
|
rowIds: entityIds,
|
|
@@ -153,10 +153,8 @@ class Synchronizer {
|
|
|
153
153
|
}, context);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
/**
|
|
157
|
-
* 自主将triggerData属性清零
|
|
158
|
-
*/
|
|
159
156
|
const operIds = queue.map(ele => ele.oper.id);
|
|
157
|
+
// 在内部清理相应的triggerData
|
|
160
158
|
await context.operate('oper', {
|
|
161
159
|
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
162
160
|
action: 'update',
|
|
@@ -359,6 +357,7 @@ class Synchronizer {
|
|
|
359
357
|
}
|
|
360
358
|
}));
|
|
361
359
|
if (unPushedIds.length > 0) {
|
|
360
|
+
// 在内部清理相应的triggerData
|
|
362
361
|
await context.operate('oper', {
|
|
363
362
|
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
364
363
|
action: 'update',
|
|
@@ -379,9 +378,15 @@ class Synchronizer {
|
|
|
379
378
|
}
|
|
380
379
|
}
|
|
381
380
|
if (result) {
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
|
|
381
|
+
const exceptions = result.filter(ele => ele instanceof Error);
|
|
382
|
+
if (exceptions.length > 0) {
|
|
383
|
+
const notPartialSuccess = exceptions.find(ele => !(ele instanceof types_1.OakPartialSuccess));
|
|
384
|
+
if (notPartialSuccess) {
|
|
385
|
+
throw notPartialSuccess;
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
console.warn('出现了PartialSuccess,部分Oper同步失败,事务仍然提交');
|
|
389
|
+
}
|
|
385
390
|
}
|
|
386
391
|
}
|
|
387
392
|
}
|
|
@@ -488,6 +493,7 @@ class Synchronizer {
|
|
|
488
493
|
strict: 'makeSure',
|
|
489
494
|
singleton: true,
|
|
490
495
|
grouped: true,
|
|
496
|
+
cleanTriggerDataBySelf: true,
|
|
491
497
|
check: (operation) => {
|
|
492
498
|
const { data } = operation;
|
|
493
499
|
const { targetEntity, action } = data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-backend-base",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.15",
|
|
4
4
|
"description": "oak-backend-base",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"author": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"node-schedule": "^2.1.0",
|
|
23
23
|
"oak-common-aspect": "^3.0.5",
|
|
24
24
|
"oak-db": "^3.3.5",
|
|
25
|
-
"oak-domain": "^5.1.
|
|
26
|
-
"oak-frontend-base": "^5.3.
|
|
27
|
-
"socket.io": "^4.
|
|
25
|
+
"oak-domain": "^5.1.16",
|
|
26
|
+
"oak-frontend-base": "^5.3.25",
|
|
27
|
+
"socket.io": "^4.8.1",
|
|
28
28
|
"socket.io-client": "^4.7.2",
|
|
29
29
|
"uuid": "^8.3.2"
|
|
30
30
|
},
|