Repository navigation
fix: 发版回查窗口从 30 秒放到 4 分钟,别再误判 CDN 延迟 - #5
Merged
Merged
Conversation
第一次实跑 v0.9.0 就翻车了:npm publish 明明成功(日志里 "+ dsh-cura@0.9.0"、 provenance 也发到了 sigstore),紧接着的回查只等了 30 秒就判定失败, release job 被跳过,整个 run 红着。 npm 自己在输出里写了 "Your package is being processed and may take a few minutes to become available"——30 秒窗口比它自己声明的延迟还短。 改法: - 窗口 10 × 3s → 24 × 10s(4 分钟) - 查询加 --prefer-online,绕过本地 CDN 缓存,否则查到的是旧缓存 - 每次未命中打印第几次重试,失败时能看出是"一直没上去"还是"最后才上去" 补三条断言盯着这件事:窗口是分钟级且带 --prefer-online、超时才失败而不是 首次没查到就失败、回查只在真上传过的那次跑(跳过 publish 时不该卡在回查)。 三条变异全部 EXIT=1:窗口退回 30 秒 / 去掉 --prefer-online / 去掉 if 守卫。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
第一次实跑
v0.9.0就翻车:npm publish明明成功——紧接着的「发完回查」只等了 30 秒就判定失败,
releasejob 被跳过,整个 run 红着。根因
npm 自己在输出里写得很清楚:
我给的窗口是
10 × 3s = 30 秒,比 npm 自己声明的延迟还短。registry 的 CDN 边缘节点这时候还没拿到新版本,npm view查不到,于是「发成功了」被读成「发失败了」。而且
npm view默认会走本地缓存,刚发完立刻查,很可能拿到的就是「没有这个版本」的旧缓存。改法
10 × 3s= 30 秒24 × 10s= 4 分钟npm viewnpm view --prefer-online4 分钟是个折中:等太短会把 CDN 抖动当成发版失败(这次就是),等太久又把真失败拖成十分钟。
测试
新增三条断言,都盯着这次踩的坑:
--prefer-online;三条变异全部
EXIT=1,还原后 8 套全绿:10 × 3s--prefer-onlineif: published == 'true'守卫遗留
v0.9.0那个 run 是红的,但包已经发上去了(latest= 0.9.0,npm install dsh-cura@0.9.0能装)。Release 也是之前手建的。所以这次不需要补发,只是把误判的判定条件修掉。