Skip to content

Commit

Permalink
Adds config value for package policy update concurrency with default …
Browse files Browse the repository at this point in the history
…value 10
  • Loading branch information
dasansol92 committed Jun 26, 2023
1 parent cd628a2 commit ad11a8f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions x-pack/plugins/security_solution/server/config.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const createMockConfig = (): ConfigType => {
maxTimelineImportPayloadBytes: 10485760,
enableExperimental,
packagerTaskInterval: '60s',
packagerTaskPackagePolicyUpdateConcurrency: 10,
prebuiltRulesPackageVersion: '',
alertMergeStrategy: 'missingFields',
alertIgnoreFields: [],
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/security_solution/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ export const configSchema = schema.object({
*/
packagerTaskInterval: schema.string({ defaultValue: '60s' }),

/**
* Artifacts Configuration for package policy update concurrency
*/
packagerTaskPackagePolicyUpdateConcurrency: schema.number({ defaultValue: 10, max: 50, min: 1 }),

/**
* For internal use. Specify which version of the Detection Rules fleet package to install
* when upgrading rules. If not provided, the latest compatible package will be installed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const buildManifestManagerContextMock = (
artifactClient: createEndpointArtifactClientMock(),
logger: loggingSystemMock.create().get() as jest.Mocked<Logger>,
experimentalFeatures: parseExperimentalConfigValue([]).features,
packagerTaskPackagePolicyUpdateConcurrency: 10,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export interface ManifestManagerContext {
packagePolicyService: PackagePolicyClient;
logger: Logger;
experimentalFeatures: ExperimentalFeatures;
packagerTaskPackagePolicyUpdateConcurrency: number;
}

const getArtifactIds = (manifest: ManifestSchema) =>
Expand All @@ -112,6 +113,7 @@ export class ManifestManager {
protected schemaVersion: ManifestSchemaVersion;
protected experimentalFeatures: ExperimentalFeatures;
protected cachedExceptionsListsByOs: Map<string, ExceptionListItemSchema[]>;
protected packagerTaskPackagePolicyUpdateConcurrency: number;

constructor(context: ManifestManagerContext) {
this.artifactClient = context.artifactClient;
Expand All @@ -122,6 +124,8 @@ export class ManifestManager {
this.schemaVersion = 'v1';
this.experimentalFeatures = context.experimentalFeatures;
this.cachedExceptionsListsByOs = new Map();
this.packagerTaskPackagePolicyUpdateConcurrency =
context.packagerTaskPackagePolicyUpdateConcurrency;
}

/**
Expand Down Expand Up @@ -622,7 +626,7 @@ export class ManifestManager {
}
},
{
concurrency: 10,
concurrency: this.packagerTaskPackagePolicyUpdateConcurrency,
/** When set to false, instead of stopping when a promise rejects, it will wait for all the promises to
* settle and then reject with an aggregated error containing all the errors from the rejected promises. */
stopOnError: false,
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/security_solution/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ export class Plugin implements ISecuritySolutionPlugin {
packagePolicyService: plugins.fleet.packagePolicyService,
logger,
experimentalFeatures: config.experimentalFeatures,
packagerTaskPackagePolicyUpdateConcurrency:
config.packagerTaskPackagePolicyUpdateConcurrency,
});

// Migrate artifacts to fleet and then start the minifest task after that is done
Expand Down

0 comments on commit ad11a8f

Please sign in to comment.