mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-28 22:19:41 -08:00
refactor(core): Rename healthcheck to health check (#12122)
This commit is contained in:
parent
c5effca7d4
commit
8bb0d3d823
|
@ -1,7 +1,7 @@
|
||||||
import { ApplicationError } from 'n8n-workflow';
|
import { ApplicationError } from 'n8n-workflow';
|
||||||
import { createServer } from 'node:http';
|
import { createServer } from 'node:http';
|
||||||
|
|
||||||
export class HealthcheckServer {
|
export class HealthCheckServer {
|
||||||
private server = createServer((_, res) => {
|
private server = createServer((_, res) => {
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
res.end('OK');
|
res.end('OK');
|
||||||
|
@ -21,7 +21,7 @@ export class HealthcheckServer {
|
||||||
|
|
||||||
this.server.listen(port, host, () => {
|
this.server.listen(port, host, () => {
|
||||||
this.server.removeListener('error', portInUseErrorHandler);
|
this.server.removeListener('error', portInUseErrorHandler);
|
||||||
console.log(`Healthcheck server listening on ${host}, port ${port}`);
|
console.log(`Health check server listening on ${host}, port ${port}`);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -3,10 +3,10 @@ import Container from 'typedi';
|
||||||
|
|
||||||
import { MainConfig } from './config/main-config';
|
import { MainConfig } from './config/main-config';
|
||||||
import type { ErrorReporter } from './error-reporter';
|
import type { ErrorReporter } from './error-reporter';
|
||||||
import type { HealthcheckServer } from './healthcheck-server';
|
import type { HealthCheckServer } from './health-check-server';
|
||||||
import { JsTaskRunner } from './js-task-runner/js-task-runner';
|
import { JsTaskRunner } from './js-task-runner/js-task-runner';
|
||||||
|
|
||||||
let healthcheckServer: HealthcheckServer | undefined;
|
let healthCheckServer: HealthCheckServer | undefined;
|
||||||
let runner: JsTaskRunner | undefined;
|
let runner: JsTaskRunner | undefined;
|
||||||
let isShuttingDown = false;
|
let isShuttingDown = false;
|
||||||
let errorReporter: ErrorReporter | undefined;
|
let errorReporter: ErrorReporter | undefined;
|
||||||
|
@ -29,7 +29,7 @@ function createSignalHandler(signal: string, timeoutInS = 10) {
|
||||||
if (runner) {
|
if (runner) {
|
||||||
await runner.stop();
|
await runner.stop();
|
||||||
runner = undefined;
|
runner = undefined;
|
||||||
void healthcheckServer?.stop();
|
void healthCheckServer?.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorReporter) {
|
if (errorReporter) {
|
||||||
|
@ -68,9 +68,9 @@ void (async function start() {
|
||||||
const { enabled, host, port } = config.baseRunnerConfig.healthcheckServer;
|
const { enabled, host, port } = config.baseRunnerConfig.healthcheckServer;
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
const { HealthcheckServer } = await import('./healthcheck-server');
|
const { HealthCheckServer } = await import('./health-check-server');
|
||||||
healthcheckServer = new HealthcheckServer();
|
healthCheckServer = new HealthCheckServer();
|
||||||
await healthcheckServer.start(host, port);
|
await healthCheckServer.start(host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on('SIGINT', createSignalHandler('SIGINT'));
|
process.on('SIGINT', createSignalHandler('SIGINT'));
|
||||||
|
|
Loading…
Reference in a new issue