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

Commit

Permalink
fix: download row create error (#1749)
Browse files Browse the repository at this point in the history
> 包名超长时,更新下载记录接口会无限重试
* 更新下载记录前,先判断当前包名是否存在

-------------

> When the package name is too long, the update download record
interface will retry indefinitely.

* Check pkg exists, before updating the download record.
  • Loading branch information
elrrrrrrr authored Mar 25, 2023
1 parent cd60a7a commit 6769a46
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/registry/package/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ defer.setInterval(function* () {
err.message += '; name: ' + name + ', count: ' + count + ', date: ' + date;
logger.error(err);
}
// save back to globalDownloads, try again next time
count = (globalDownloads.get(name) || 0) + count;
globalDownloads.set(name, count);
var pkgExist = yield packageService.getModuleLastModified(name);
if (pkgExist) {
// save back to globalDownloads, try again next time
count = (globalDownloads.get(name) || 0) + count;
globalDownloads.set(name, count);
}
}
}
saving = false;
Expand Down

0 comments on commit 6769a46

Please sign in to comment.