Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: retry from registry when no_db_file error on replicate
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jun 8, 2018
1 parent 92acbce commit 17f8b66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/sync_module_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ SyncModuleWorker.prototype.syncByName = function* (concurrencyId, name, registry
}
}

if (status === 404 && pkg && pkg.reason === 'deleted' && registry === config.officialNpmReplicate) {
if (status === 404 && pkg && pkg.reason && registry === config.officialNpmReplicate) {
// unpublished package on replicate.npmjs.com
// 404 { error: 'not_found', reason: 'deleted' }
// try to read from registry.npmjs.com and get the whole unpublished info

// https://replicate.npmjs.com/registry-url
// {"error":"not_found","reason":"no_db_file"}
// try to read from registry.npmjs.com and get no_db_file
try {
var result = yield npmSerivce.request(packageUrl, { registry: config.sourceNpmRegistry });
pkg = result.data;
Expand Down

0 comments on commit 17f8b66

Please sign in to comment.