mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 00:56:26 +00:00
fix(packagist): Improve fetch concurrency (#20041)
This commit is contained in:
parent
5302232afa
commit
0b4db8dc6c
1 changed files with 20 additions and 19 deletions
|
@ -157,34 +157,35 @@ export class PackagistDatasource extends Datasource {
|
||||||
packages,
|
packages,
|
||||||
providersUrl,
|
providersUrl,
|
||||||
providersLazyUrl,
|
providersLazyUrl,
|
||||||
files,
|
files = [],
|
||||||
includesFiles,
|
includesFiles = [],
|
||||||
providerPackages,
|
providerPackages,
|
||||||
} = registryMeta;
|
} = registryMeta;
|
||||||
if (files) {
|
|
||||||
const queue = files.map(
|
const includesPackages: Record<string, ReleaseResult> = {};
|
||||||
(file) => (): Promise<PackagistFile> =>
|
|
||||||
this.getPackagistFile(regUrl, file)
|
const tasks: (() => Promise<void>)[] = [];
|
||||||
);
|
|
||||||
const resolvedFiles = await p.all(queue);
|
for (const file of files) {
|
||||||
for (const res of resolvedFiles) {
|
tasks.push(async () => {
|
||||||
|
const res = await this.getPackagistFile(regUrl, file);
|
||||||
for (const [name, val] of Object.entries(res.providers)) {
|
for (const [name, val] of Object.entries(res.providers)) {
|
||||||
providerPackages[name] = val.sha256;
|
providerPackages[name] = val.sha256;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
const includesPackages: Record<string, ReleaseResult> = {};
|
|
||||||
if (includesFiles) {
|
for (const file of includesFiles) {
|
||||||
for (const file of includesFiles) {
|
tasks.push(async () => {
|
||||||
const res = await this.getPackagistFile(regUrl, file);
|
const res = await this.getPackagistFile(regUrl, file);
|
||||||
if (res.packages) {
|
for (const [key, val] of Object.entries(res.packages ?? {})) {
|
||||||
for (const [key, val] of Object.entries(res.packages)) {
|
includesPackages[key] = PackagistDatasource.extractDepReleases(val);
|
||||||
const dep = PackagistDatasource.extractDepReleases(val);
|
|
||||||
includesPackages[key] = dep;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await p.all(tasks);
|
||||||
|
|
||||||
const allPackages: AllPackages = {
|
const allPackages: AllPackages = {
|
||||||
packages,
|
packages,
|
||||||
providersUrl,
|
providersUrl,
|
||||||
|
|
Loading…
Reference in a new issue