Skip to content

Commit

Permalink
Change: fetch trash targets concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell committed Jan 4, 2024
1 parent e6b8352 commit e8965eb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/gmp/commands/trashcan.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ class Trashcan extends HttpCommand {
}

get() {
return this.httpGet({cmd: 'get_trash'}).then(response => {
const targets = this.httpGet({cmd: 'get_trash_targets'});
const rest = this.httpGet({cmd: 'get_trash'});
return Promise.all([targets, rest]).then(([response_targets, response]) => {
const targets_data = response_targets.data.get_trash;

Check warning on line 72 in src/gmp/commands/trashcan.js

View check run for this annotation

Codecov / codecov/patch

src/gmp/commands/trashcan.js#L69-L72

Added lines #L69 - L72 were not covered by tests
const trash_data = response.data.get_trash;
const data = {};
if (isDefined(trash_data.get_alerts_response)) {
Expand Down Expand Up @@ -146,9 +149,10 @@ class Trashcan extends HttpCommand {
Tag.fromElement(model),
);
}
if (isDefined(trash_data.get_targets_response)) {
data.target_list = map(trash_data.get_targets_response.target, model =>
Target.fromElement(model),
if (isDefined(targets_data.get_targets_response)) {
data.target_list = map(

Check warning on line 153 in src/gmp/commands/trashcan.js

View check run for this annotation

Codecov / codecov/patch

src/gmp/commands/trashcan.js#L153

Added line #L153 was not covered by tests
targets_data.get_targets_response.target,
model => Target.fromElement(model),

Check warning on line 155 in src/gmp/commands/trashcan.js

View check run for this annotation

Codecov / codecov/patch

src/gmp/commands/trashcan.js#L155

Added line #L155 was not covered by tests
);
}
if (isDefined(trash_data.get_tasks_response)) {
Expand Down

0 comments on commit e8965eb

Please sign in to comment.