Skip to content

Commit

Permalink
Add missing dependency abort-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Jun 17, 2020
1 parent 641141e commit 7f3381c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
2 changes: 2 additions & 0 deletions x-pack/plugins/ingest_manager/common/constants/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ export const AGENT_TYPE_TEMPORARY = 'TEMPORARY';

export const AGENT_POLLING_THRESHOLD_MS = 30000;
export const AGENT_POLLING_INTERVAL = 1000;
export const AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS = 30000;
export const AGENT_UPDATE_ACTIONS_INTERVAL_MS = 5000;
5 changes: 4 additions & 1 deletion x-pack/plugins/ingest_manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"name": "ingest-manager",
"version": "8.0.0",
"private": true,
"license": "Elastic-License"
"license": "Elastic-License",
"dependencies": {
"abort-controller": "^3.0.0"
}
}
2 changes: 2 additions & 0 deletions x-pack/plugins/ingest_manager/server/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export {
AGENT_TYPE_TEMPORARY,
AGENT_POLLING_THRESHOLD_MS,
AGENT_POLLING_INTERVAL,
AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS,
AGENT_UPDATE_ACTIONS_INTERVAL_MS,
INDEX_PATTERN_PLACEHOLDER_SUFFIX,
// Routes
PLUGIN_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import { Agent } from '../../../types';
import { appContextService } from '../../app_context';
import { agentCheckinStateConnectedAgentsFactory } from './state_connected_agents';
import { agentCheckinStateNewActionsFactory } from './state_new_actions';

const UPDATE_LAST_CHECKIN_INTERVAL_MS = 15000;
import { AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS } from '../../../constants';

function agentCheckinStateFactory() {
const agentConnected = agentCheckinStateConnectedAgentsFactory();
Expand All @@ -23,7 +22,7 @@ function agentCheckinStateFactory() {
} catch (err) {
appContextService.getLogger().error(err);
}
}, UPDATE_LAST_CHECKIN_INTERVAL_MS);
}, AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS);
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ import {
} from '../../../types';
import { agentConfigService } from '../../agent_config';
import * as APIKeysService from '../../api_keys';
import { AGENT_SAVED_OBJECT_TYPE } from '../../../constants';
import { AGENT_SAVED_OBJECT_TYPE, AGENT_UPDATE_ACTIONS_INTERVAL_MS } from '../../../constants';
import { createAgentAction, getNewActionsSince } from '../actions';
import { appContextService } from '../../app_context';
import { toPromiseAbortable, AbortError } from './rxjs_utils';

const UPDATE_ACTIONS_INTERVAL_MS = 10000;

function getInternalUserSOClient() {
const fakeRequest = ({
headers: {},
Expand All @@ -53,7 +51,7 @@ function getInternalUserSOClient() {

function createAgentConfigSharedObservable(configId: string) {
const internalSOClient = getInternalUserSOClient();
return timer(0, UPDATE_ACTIONS_INTERVAL_MS).pipe(
return timer(0, AGENT_UPDATE_ACTIONS_INTERVAL_MS).pipe(
switchMap(() =>
from(agentConfigService.get(internalSOClient, configId) as Promise<AgentConfig>)
),
Expand All @@ -64,7 +62,7 @@ function createAgentConfigSharedObservable(configId: string) {
}

function createNewActionsSharedObservable(): Observable<AgentAction[]> {
return timer(0, UPDATE_ACTIONS_INTERVAL_MS).pipe(
return timer(0, AGENT_UPDATE_ACTIONS_INTERVAL_MS).pipe(
switchMap(() => {
const internalSOClient = getInternalUserSOClient();

Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6398,6 +6398,13 @@ abort-controller@^2.0.3:
dependencies:
event-target-shim "^5.0.0"

abort-controller@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
dependencies:
event-target-shim "^5.0.0"

abortcontroller-polyfill@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.4.0.tgz#0d5eb58e522a461774af8086414f68e1dda7a6c4"
Expand Down

0 comments on commit 7f3381c

Please sign in to comment.