@axah/koa
Advanced tools
Comparing version 0.0.0-20231011072643 to 0.0.0-20231011083437
@@ -10,5 +10,2 @@ "use strict"; | ||
exports.markServiceAsReady = markServiceAsReady; | ||
const giveTimeForLogToFlushAndFilebeatToReadTheLogs = () => new Promise((resolve) => { | ||
setTimeout(resolve, 15000); | ||
}); | ||
const setupHealthChecks = ({ server, log, cleanup, shutdownTimeout = 30000, }) => { | ||
@@ -29,9 +26,7 @@ const healthChecks = { | ||
timeout: shutdownTimeout, | ||
beforeShutdown: () => Promise.resolve(log.info('Terminus received SIGTERM. Will stop server gracefully')), | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
beforeShutdown: async () => log.info('Terminus received SIGTERM. Will stop server gracefully'), | ||
onShutdown: async () => { | ||
log.info('Terminus has gracefully shutdown. Will execute cleanup next'); | ||
await cleanup.runCleanupManually(); | ||
log.info('Cleanup has successfully finished. Will wait now for logs to flush'); | ||
log.flush(); | ||
await giveTimeForLogToFlushAndFilebeatToReadTheLogs(); | ||
}, | ||
@@ -38,0 +33,0 @@ logger: (msg, err) => log.error({ err }, `Terminus health check error with message: ${msg}`), |
@@ -126,2 +126,5 @@ "use strict"; | ||
return async function middleware(ctx, next) { | ||
if (ctx.url.startsWith('/_health')) { | ||
return next(); | ||
} | ||
const mdc = parseMdcFromHeaders(logger, ctx.req.headers); | ||
@@ -128,0 +131,0 @@ return mdcAls.run(mdc, () => { |
{ | ||
"name": "@axah/koa", | ||
"version": "0.0.0-20231011072643", | ||
"version": "0.0.0-20231011083437", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "license": "UNLICENSED", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
42297
648