Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
shell: bash
run: |
for attempt in $(seq 1 10); do
if npm whoami --registry=https://registry.npmjs.org; then exit 0; fi
if timeout 30 npm whoami --registry=https://registry.npmjs.org; then exit 0; fi
echo "npm whoami failed (attempt ${attempt}/10); retrying after the registry settles"
sleep 30
done
Expand Down
5 changes: 3 additions & 2 deletions script/release-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ function sleepSync(ms) {
function npmView(spec, field) {
let last
for (let attempt = 1; attempt <= 4; attempt += 1) {
const result = spawnSync('npm', ['view', spec, field, '--json'], { cwd: ROOT, encoding: 'utf8' })
const result = spawnSync('npm', ['view', spec, field, '--json'], { cwd: ROOT, encoding: 'utf8', timeout: 30_000 })
const failure = `${result.stderr ?? ''}${result.error?.message ?? ''}`
if (result.status === 0 || !RETRYABLE_NPM.test(failure)) return readNpmView(result, spec, field)
const timedOut = result.error?.code === 'ETIMEDOUT' || result.signal !== null
if (result.status === 0 || (!timedOut && !RETRYABLE_NPM.test(failure))) return readNpmView(result, spec, field)
last = new Error(`npm view ${spec} ${field} failed during a registry outage (attempt ${attempt}/4)`)
if (attempt < 4) sleepSync(attempt * 3_000)
}
Expand Down
Loading