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

[8.6] increase bulk action retry to 5 (#148169) #148194

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions x-pack/plugins/fleet/server/services/agents/action_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { getAgentActions } from './actions';
import { closePointInTime, getAgentsByKuery } from './crud';
import type { BulkActionsResolver } from './bulk_actions_resolver';

export const MAX_RETRY_COUNT = 3;
export const MAX_RETRY_COUNT = 5;

export interface ActionParams {
kuery: string;
Expand Down Expand Up @@ -113,10 +113,10 @@ export abstract class ActionRunner {
);

if (this.retryParams.retryCount === MAX_RETRY_COUNT) {
const errorMessage = `Stopping after ${MAX_RETRY_COUNT}rd retry. Error: ${error.message}`;
const errorMessage = `Stopping after retry #${MAX_RETRY_COUNT}. Error: ${error.message}`;
appContextService.getLogger().warn(errorMessage);

// clean up tasks after 3rd retry reached
// clean up tasks after last retry reached
await Promise.all([
this.bulkActionsResolver!.removeIfExists(this.checkTaskId!),
this.bulkActionsResolver!.removeIfExists(this.retryParams.taskId!),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ describe('update_agent_tags', () => {
tagsToRemove: [],
kuery: '',
total: 100,
retryCount: 3,
retryCount: 5,
}
)
).rejects.toThrowError('version conflict of 100 agents');
const errorResults = esClient.bulk.mock.calls[0][0] as any;
expect(errorResults.body[1].error).toEqual('version conflict on 3rd retry');
expect(errorResults.body[1].error).toEqual('version conflict on last retry');
});

it('should run add tags async when actioning more agents than batch size', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export async function updateTagsBatch(
getUuidArray(res.version_conflicts!).map((id) => ({
agentId: id,
actionId,
error: 'version conflict on 3rd retry',
error: 'version conflict on last retry',
}))
);
}
Expand Down