feat(vloop): 页面里的图改为 mermaid 渲染

9 个章节的 20 张 ASCII 图改为 mermaid 图。站点自带 mermaid 11.15.0,由 assets/doc.js 按需加载并渲染。
05 章的 import 边是邻接清单。63 条边画成一张图不可读,因此保留原文。
验证:node tools/build-nav.js 与 node tools/check-pages.js 均退出 0。headless Chrome 逐页渲染,svg 数与图块数一致。
This commit is contained in:
2026-11-03 21:49:47 +08:00
parent 142f4f8559
commit f171808072
20 changed files with 4089 additions and 433 deletions

View File

@@ -272,18 +272,23 @@ case DispositionPark:
<p>「假失败」仍然真实存在:<code>PublishJSON</code> 用 <code>mandatory=false</code> 且没有发布确认,broker 已经收下消息、API 却因为连接在确认前断开而返回错误。区别在于——<b>现在两条路都带着同一个幂等键</b>,重复写入会被数据库挡掉。</p>
<pre data-lang="text" data-name="假失败的时间线(评论)">t0 用户发评论,request_id = R
t1 API 调 commentMQ.Publish(EventID = R) → 消息已进 broker
t2 连接在确认前断开,API 认为发布失败(err != nil)
t3 API 走降级:CreateIdempotentWithPopularity(comment{R}, +1)
t4 API 返回 200,用户看到评论成功
t5 CommentWorker 收到那条"以为失败"的消息
t6 再调 CreateIdempotentWithPopularity(comment{R}, +1)
→ uk_comments_author_key(author_id, idempotency_key) 命中
→ RowsAffected = 0
t7 created = false → 不加热度,Ack
结果:一条评论、一次热度。重复被唯一索引吸收。</pre>
<pre class="mermaid" data-lang="mermaid" data-name="假失败的时间线(评论)">sequenceDiagram
participant U as 用户
participant API as API
participant MQ as RabbitMQ
participant CW as CommentWorker
participant DB as MySQL
U->>API: t0 用户发评论 request_id = R
API->>MQ: t1 commentMQ.Publish(EventID = R) 消息已进 broker
MQ-->>API: t2 连接在确认前断开 API 认为发布失败 err != nil
API->>DB: t3 走降级 CreateIdempotentWithPopularity(comment{R} +1)
API-->>U: t4 返回 200 用户看到评论成功
MQ->>CW: t5 CommentWorker 收到那条「以为失败」的消息
CW->>DB: t6 再调 CreateIdempotentWithPopularity(comment{R} +1)
DB-->>CW: uk_comments_author_key(author_id, idempotency_key) 命中
DB-->>CW: RowsAffected = 0
CW->>CW: t7 created = false 不加热度 Ack
Note over U,DB: 结果 一条评论、一次热度。重复被唯一索引吸收</pre>
<div class="tablewrap">
<table>