知识卡片
重复入账使余额多加
对账户12345增加500的请求,如果已生效但响应未被确认,调用者可能再次提交相同内容;服务若每次都执行累加,就会多增加500。根因是相同业务动作在接收端被当成两笔独立指令,不能从“没收到响应”推断第一次未执行。方案另见[[按交易身份识别重放]]。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Resilience · 查看原书依据
But what about an operation like “add $500 to account 12345”? Such a request might carry a JSON payload that looks something like the following: { "credit":{ "accountID": 12345, "amount": 500 } } Repeated applications of this operation would lead to an extra $500 going to account 12345, and while the owner of the account
参考来源
- 位置:《Cloud Native Go》第09章《Resilience》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch09.xhtml)
- 结论依据:对账户12345增加500的请求,如果已生效但响应未被确认,调用者可能再次提交相同内容;服务若每次都执行累加,就会多增加500。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。
- 原始内容:But what about an operation like “add $500 to account 12345”? Such a request might carry a JSON payload that looks something like the following: { "credit":{ "accountID": 12345, "amount": 500 } } Repeated applications of this operation would lead to an extra $500 going to account 12345, and while the owner of the account