refactor(core): Rename healthcheck to health check (#12122)

This commit is contained in:
Tomi Turtiainen 2024-12-10 13:00:30 +02:00 committed by GitHub
parent c5effca7d4
commit 8bb0d3d823
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View file

@ -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();
}); });
}); });

View file

@ -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'));