Skip to content

Commit

Permalink
do not limit recursion into lists (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
carrolp authored Dec 1, 2022
1 parent 1ee5a45 commit e55f4f0
Showing 1 changed file with 14 additions and 15 deletions.
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

0 comments on commit e55f4f0

Please sign in to comment.