Skip to content

Commit

Permalink
fixed order of cancel action
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic committed Sep 30, 2022
1 parent 81e86c0 commit 8661838
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions x-pack/plugins/fleet/server/services/agents/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,6 @@ export async function cancelAgentAction(esClient: ElasticsearchClient, actionId:
if (!hit._source || !hit._source.agents || !hit._source.action_id) {
continue;
}
await createAgentAction(esClient, {
id: cancelActionId,
type: 'CANCEL',
agents: hit._source.agents,
data: {
target_id: hit._source.action_id,
},
created_at: now,
expiration: hit._source.expiration,
});
if (hit._source.type === 'UPGRADE') {
await bulkUpdateAgents(
esClient,
Expand All @@ -277,6 +267,16 @@ export async function cancelAgentAction(esClient: ElasticsearchClient, actionId:
{}
);
}
await createAgentAction(esClient, {
id: cancelActionId,
type: 'CANCEL',
agents: hit._source.agents,
data: {
target_id: hit._source.action_id,
},
created_at: now,
expiration: hit._source.expiration,
});
}

return {
Expand Down

0 comments on commit 8661838

Please sign in to comment.