From 0c5c05423165ece12601c7bc7001d70681d9055b Mon Sep 17 00:00:00 2001 From: Andrew Cholakian Date: Mon, 27 Jan 2020 18:56:54 -0600 Subject: [PATCH] [Uptime] Simplify snapshot max to Infinity (#55931) (#56064) Fixes https://github.com/elastic/uptime/issues/119 Rather than relying on a contant for the max number of monitors, it's easier to just use infinity. This is simpler than making the iterator more complex with an 'infinite' mode. Co-authored-by: Elastic Machine --- .../plugins/uptime/common/constants/context_defaults.ts | 6 ------ .../monitor_states/elasticsearch_monitor_states_adapter.ts | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/x-pack/legacy/plugins/uptime/common/constants/context_defaults.ts b/x-pack/legacy/plugins/uptime/common/constants/context_defaults.ts index e0f0333bb8cfd8..540e60a28b066c 100644 --- a/x-pack/legacy/plugins/uptime/common/constants/context_defaults.ts +++ b/x-pack/legacy/plugins/uptime/common/constants/context_defaults.ts @@ -19,10 +19,4 @@ export const CONTEXT_DEFAULTS = { cursorDirection: CursorDirection.AFTER, sortOrder: SortOrder.ASC, }, - - /** - * Defines the maximum number of monitors to iterate on - * in a single count session. The intention is to catch as many as possible. - */ - MAX_MONITORS_FOR_SNAPSHOT_COUNT: 1000000, }; diff --git a/x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/elasticsearch_monitor_states_adapter.ts b/x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/elasticsearch_monitor_states_adapter.ts index eaaa8087e57cdd..7ed973e6f057d2 100644 --- a/x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/elasticsearch_monitor_states_adapter.ts +++ b/x-pack/legacy/plugins/uptime/server/lib/adapters/monitor_states/elasticsearch_monitor_states_adapter.ts @@ -61,7 +61,7 @@ export const elasticsearchMonitorStatesAdapter: UMMonitorStatesAdapter = { dateRangeEnd, CONTEXT_DEFAULTS.CURSOR_PAGINATION, filters && filters !== '' ? JSON.parse(filters) : null, - CONTEXT_DEFAULTS.MAX_MONITORS_FOR_SNAPSHOT_COUNT, + Infinity, statusFilter );