@bbc/sofie-server-core-integration
Version:
Library for connecting to Core
30 lines • 1.08 kB
TypeScript
import { EventEmitter } from 'events';
export type WatchDogCheckFunction = () => Promise<any>;
export type WatchDogEvents = {
message: [message: string];
exit: [];
};
/**
* Watchdog is used to make sure there is a working connection with Core.
* Usage: in the function provided to addCheck, we should send a message to core
* and resolve the returned promise when we've got a good reply.
* If the Watchdog doesn't get it's checkFunctions resolved withing a certain time
* it will forcefully quit the Node process (or emit the 'exit' event.
*/
export declare class WatchDog extends EventEmitter<WatchDogEvents> {
timeout: number;
private _checkTimeout;
private _dieTimeout;
private _watching;
private _checkFunctions;
private _runningChecks;
constructor(_timeout?: number);
startWatching(): void;
stopWatching(): void;
addCheck(fcn: () => Promise<any>): void;
removeCheck(fcn: () => Promise<any>): void;
receivedData(): void;
private _everythingIsOk;
private _watch;
}
//# sourceMappingURL=watchDog.d.ts.map