diff --git a/packages/kbn-optimizer/src/optimizer/observe_worker.ts b/packages/kbn-optimizer/src/optimizer/observe_worker.ts index 1bf19f14d3b04..90c53f1ef9e87 100644 --- a/packages/kbn-optimizer/src/optimizer/observe_worker.ts +++ b/packages/kbn-optimizer/src/optimizer/observe_worker.ts @@ -24,10 +24,12 @@ import { inspect } from 'util'; import * as Rx from 'rxjs'; import { map, filter, takeUntil } from 'rxjs/operators'; -import { isWorkerMsg, isWorkerPing, WorkerConfig, WorkerMsg, Bundle } from '../common'; +import { isWorkerMsg, isWorkerPing, WorkerConfig, WorkerMsg, Bundle, ParentMsgs } from '../common'; import { OptimizerConfig } from './optimizer_config'; +const parentMsgs = new ParentMsgs(); + export interface WorkerStdio { type: 'worker stdio'; stream: 'stdout' | 'stderr'; @@ -152,8 +154,7 @@ export function observeWorker( return true; } - const pong: WorkerPongMsg = { type: 'pong' }; - proc.send(pong); + proc.send(parentMsgs.pong()); return false; }),