From 9d30db7c029cfb68845cffe1f50abca5fb72be7e Mon Sep 17 00:00:00 2001 From: YulNaumenko Date: Mon, 4 Oct 2021 10:14:19 -0700 Subject: [PATCH] fixed due to comments --- docs/settings/alert-action-settings.asciidoc | 2 +- x-pack/plugins/alerting/server/config.ts | 2 +- x-pack/plugins/alerting/server/plugin.test.ts | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/settings/alert-action-settings.asciidoc b/docs/settings/alert-action-settings.asciidoc index b69a4d487a96c..b7f513e74774e 100644 --- a/docs/settings/alert-action-settings.asciidoc +++ b/docs/settings/alert-action-settings.asciidoc @@ -181,7 +181,7 @@ For example, `20m`, `24h`, `7d`, `1w`. Default: `60s`. Sets the number of actions that will be executed ephemerally. To use this, enable ephemeral tasks in task manager first with <> `xpack.alerting.defaultRuleTaskTimeout`:: -Specifies the default framework timeout for the all rule types tasks. Task timeout could be overridden by the rule type producer during registration. The time is formatted as: +Specifies the default timeout for the all rule types tasks. Task timeout could be overridden by the rule type producer during registration. The time is formatted as: + `[ms,s,m,h,d,w,M,Y]` + diff --git a/x-pack/plugins/alerting/server/config.ts b/x-pack/plugins/alerting/server/config.ts index d82f8d240ec88..277f0c7297df9 100644 --- a/x-pack/plugins/alerting/server/config.ts +++ b/x-pack/plugins/alerting/server/config.ts @@ -20,7 +20,7 @@ export const configSchema = schema.object({ maxEphemeralActionsPerAlert: schema.number({ defaultValue: DEFAULT_MAX_EPHEMERAL_ACTIONS_PER_ALERT, }), - defaultRuleTaskTimeout: schema.string({ validate: validateDurationSchema, defaultValue: '10m' }), + defaultRuleTaskTimeout: schema.string({ validate: validateDurationSchema, defaultValue: '5m' }), }); export type AlertsConfig = TypeOf; diff --git a/x-pack/plugins/alerting/server/plugin.test.ts b/x-pack/plugins/alerting/server/plugin.test.ts index 6d3a8e80ffca4..46ec4c52afb06 100644 --- a/x-pack/plugins/alerting/server/plugin.test.ts +++ b/x-pack/plugins/alerting/server/plugin.test.ts @@ -144,6 +144,14 @@ describe('Alerting Plugin', () => { minimumLicenseRequired: 'basic', }); }); + + it('should apply default config value for ruleTaskTimeout', async () => { + setup.registerType({ + ...sampleAlertType, + minimumLicenseRequired: 'basic', + }); + expect(sampleAlertType.ruleTaskTimeout).toBe('5m'); + }); }); });