优化
This commit is contained in:
@@ -47,12 +47,12 @@ export function shouldReconcileCompletion(error = {}) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A retry keeps the original operationId while taking the latest server
|
||||
* version/command facts. It must never mint a new idempotency identity.
|
||||
* A retry keeps the original operationId and the exact accepted request facts.
|
||||
* expectedTaskVersion participates in requestHash and must not be refreshed.
|
||||
*/
|
||||
export function refreshCompletionAttempt(previousAttempt = {}, latestFacts = {}) {
|
||||
if (!previousAttempt.operationId) throw new Error('缺少原完成操作标识,不能安全重试')
|
||||
const expectedTaskVersion = latestFacts.expectedTaskVersion ?? latestFacts.taskVersion ?? previousAttempt.expectedTaskVersion
|
||||
const expectedTaskVersion = previousAttempt.expectedTaskVersion
|
||||
if (expectedTaskVersion === null || expectedTaskVersion === undefined) throw new Error('缺少服务端最新任务版本,不能安全重试')
|
||||
return {
|
||||
...previousAttempt,
|
||||
@@ -61,4 +61,3 @@ export function refreshCompletionAttempt(previousAttempt = {}, latestFacts = {})
|
||||
expectedTaskVersion: Number(expectedTaskVersion)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user