fix: download row create error (#1749)

> 包名超长时,更新下载记录接口会无限重试
* 更新下载记录前,先判断当前包名是否存在

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

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

* Check pkg exists, before updating the download record.
This commit is contained in:
elrrrrrrr
2023-03-25 21:40:50 +08:00
committed by GitHub
parent cd60a7aa82
commit 6769a46d71

View File

@@ -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;