知识卡片
延时撤销在提交前取消
延时撤销先把变更置于短期等待,而非立即提交;若用户在窗口内取消,就丢弃待执行请求,底层从未看到原变更。典型过程是排队五秒、期间允许取消,窗口结束才执行。
它降低撤回已提交副作用的难度,却给每次支持撤销的写入增加固定延迟,层层叠加后可能显著拖慢流程。适合能容忍延迟的批处理与排队工作;开始执行后不能再假定可安全取消,更不保证多处写入原子完成。
结构图:
flowchart TD
A[接收变更请求] --> B[保持待执行]
B --> C{窗口内取消}
C -->|是| D[丢弃请求]
C -->|否| E[等待期结束后执行]
E --> F[返回执行结果]
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 超媒体工作流 · 查看原书依据
If, in that time frame, the API caller discovers its mistake and sends the undoUpdateCustomer message, you can simply ignore the original request. In this case, the underlying service(s) never sees the original updateCustomer action and there is no possibility that undoing a committed transaction will invalidate some other part of the system.
参考来源
- 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第7章《超媒体工作流》§7.17(来源项目:book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch07.xhtml)
- 结论依据:原文以延时撤销先把变更置于短期等待,而非立即提交;若用户在窗口内取消,就丢弃待执行请求,底层从未看到原变更的方式说明该用途;同节示例与讨论补充了卡内条件和边界。
- 原始内容:If, in that time frame, the API caller discovers its mistake and sends the undoUpdateCustomer message, you can simply ignore the original request. In this case, the underlying service(s) never sees the original updateCustomer action and there is no possibility that undoing a committed transaction will invalidate some other part of the system.