Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not limit recursion into lists #365

Merged
merged 1 commit into from
Dec 1, 2022
Merged
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
29 changes: 14 additions & 15 deletions lib/BaseDownloadController.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,21 @@ module.exports = class BaseDownloadController extends CompositeController {
if (Array.isArray(file)) {
let error;
let res = await Promise.all(file.map(async f => {
return this.limit(async () => {
try {
return await this._decomposeFile(f);
} catch (e) {
error = error || e;
}
});
try {
return await this._decomposeFile(f);
} catch (e) {
error = error || e;
}
}));
return error ? Promise.reject(error) : res;
} else if (kind.toLowerCase() == 'list' && Array.isArray(items)) {
let error;
let res = await Promise.all(items.map(async f => {
return this.limit(async () => {
try {
return await this._decomposeFile(f);
} catch (e) {
error = error || e;
}
});
try {
return await this._decomposeFile(f);
} catch (e) {
error = error || e;
}
}));
return error ? Promise.reject(error) : res;
} else if (file) {
Expand Down Expand Up @@ -259,7 +255,10 @@ module.exports = class BaseDownloadController extends CompositeController {
}

async _saveChild(child) {
let res = await this.applyChild(child);
let res = await this.limit(async () => {
return await this.applyChild(child);
});

if (!res.statusCode || res.statusCode < 200 || res.statusCode >= 300) {
return Promise.reject(res);
}
Expand Down