修正了synchronizer内部的一些问题,标注了该volatiletrigger为cleanTriggerDataBySelf
This commit is contained in:
parent
9449a355c8
commit
e03d1bb51a
|
|
@ -144,7 +144,7 @@ class Synchronizer {
|
|||
}
|
||||
}, {});
|
||||
const entityIds = operEntityArr.map(ele => ele.entityId);
|
||||
return onSynchronized({
|
||||
await onSynchronized({
|
||||
action: oper.action,
|
||||
data: oper.data,
|
||||
rowIds: entityIds,
|
||||
|
|
@ -153,10 +153,8 @@ class Synchronizer {
|
|||
}, context);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 自主将triggerData属性清零
|
||||
*/
|
||||
const operIds = queue.map(ele => ele.oper.id);
|
||||
// 在内部清理相应的triggerData
|
||||
await context.operate('oper', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'update',
|
||||
|
|
@ -359,6 +357,7 @@ class Synchronizer {
|
|||
}
|
||||
}));
|
||||
if (unPushedIds.length > 0) {
|
||||
// 在内部清理相应的triggerData
|
||||
await context.operate('oper', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'update',
|
||||
|
|
@ -379,9 +378,15 @@ class Synchronizer {
|
|||
}
|
||||
}
|
||||
if (result) {
|
||||
const exception = result.find(ele => ele instanceof Error);
|
||||
if (exception) {
|
||||
throw exception;
|
||||
const exceptions = result.filter(ele => ele instanceof Error);
|
||||
if (exceptions.length > 0) {
|
||||
const notPartialSuccess = exceptions.find(ele => !(ele instanceof types_1.OakPartialSuccess));
|
||||
if (notPartialSuccess) {
|
||||
throw notPartialSuccess;
|
||||
}
|
||||
else {
|
||||
console.warn('出现了PartialSuccess,部分Oper同步失败,事务仍然提交');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -488,6 +493,7 @@ class Synchronizer {
|
|||
strict: 'makeSure',
|
||||
singleton: true,
|
||||
grouped: true,
|
||||
cleanTriggerDataBySelf: true,
|
||||
check: (operation) => {
|
||||
const { data } = operation;
|
||||
const { targetEntity, action } = data;
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ export default class Synchronizer<ED extends EntityDict & BaseEntityDict, Cxt ex
|
|||
{}
|
||||
);
|
||||
const entityIds = operEntityArr.map(ele => ele.entityId!);
|
||||
return onSynchronized({
|
||||
await onSynchronized({
|
||||
action: oper.action!,
|
||||
data: oper.data!,
|
||||
rowIds: entityIds,
|
||||
|
|
@ -214,12 +214,10 @@ export default class Synchronizer<ED extends EntityDict & BaseEntityDict, Cxt ex
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自主将triggerData属性清零
|
||||
*/
|
||||
const operIds = queue.map(
|
||||
ele => ele.oper.id!
|
||||
);
|
||||
// 在内部清理相应的triggerData
|
||||
await context.operate('oper', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
|
|
@ -473,6 +471,7 @@ export default class Synchronizer<ED extends EntityDict & BaseEntityDict, Cxt ex
|
|||
)
|
||||
);
|
||||
if (unPushedIds.length > 0) {
|
||||
// 在内部清理相应的triggerData
|
||||
await context.operate('oper', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
|
|
@ -494,9 +493,17 @@ export default class Synchronizer<ED extends EntityDict & BaseEntityDict, Cxt ex
|
|||
}
|
||||
|
||||
if (result) {
|
||||
const exception = result.find(ele => ele instanceof Error);
|
||||
if (exception) {
|
||||
throw exception;
|
||||
const exceptions = result.filter(ele => ele instanceof Error);
|
||||
if (exceptions.length > 0) {
|
||||
const notPartialSuccess = exceptions.find(
|
||||
ele => !(ele instanceof OakPartialSuccess)
|
||||
);
|
||||
if (notPartialSuccess) {
|
||||
throw notPartialSuccess;
|
||||
}
|
||||
else {
|
||||
console.warn('出现了PartialSuccess,部分Oper同步失败,事务仍然提交');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -629,6 +636,7 @@ export default class Synchronizer<ED extends EntityDict & BaseEntityDict, Cxt ex
|
|||
strict: 'makeSure',
|
||||
singleton: true,
|
||||
grouped: true,
|
||||
cleanTriggerDataBySelf: true,
|
||||
check: (operation: ED['oper']['Create']) => {
|
||||
const { data } = operation as ED['oper']['CreateSingle'];
|
||||
const { targetEntity, action } = data;
|
||||
|
|
|
|||
Loading…
Reference in New Issue