Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const ms = require('ms');
const _ = require('lodash');
const Messaging = require('@terascope/teraslice-messaging');
const {
TSError, get, pDelay, getFullErrorStack, logError, pWhile
} = require('@terascope/utils');
const { waitForWorkerShutdown } = require('../helpers/worker-shutdown');
const { makeStateStore, makeExStore, SliceState } = require('../../storage');
const { makeLogger, generateWorkerId } = require('../helpers/terafoundation');
const ExecutionAnalytics = require('./execution-analytics');
const makeSliceAnalytics = require('./slice-analytics');
const Scheduler = require('./scheduler');
const Metrics = require('../metrics');
const ExecutionControllerServer = Messaging.ExecutionController.Server;
const ClusterMasterClient = Messaging.ClusterMaster.Client;
const { formatURL } = Messaging;
class ExecutionController {
constructor(context, executionContext) {
const workerId = generateWorkerId(context);
const logger = makeLogger(context, 'execution_controller');
const events = context.apis.foundation.getSystemEvents();
const slicerPort = executionContext.config.slicer_port;
const performanceMetrics = executionContext.config.performance_metrics;
const config = context.sysconfig.teraslice;
const networkLatencyBuffer = get(config, 'network_latency_buffer');
const actionTimeout = get(config, 'action_timeout');
const workerDisconnectTimeout = get(config, 'worker_disconnect_timeout');
const nodeDisconnectTimeout = get(config, 'node_disconnect_timeout');
const shutdownTimeout = get(config, 'shutdown_timeout');