fix: reduce local server status overhead

This commit is contained in:
Bohdan Triapitsyn
2026-05-05 18:47:00 +03:00
parent 962ee41bba
commit 6dd322ddbe
7 changed files with 60 additions and 20 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ export const createBootstrapRuntime = (dependencies) => {
serverStartedAt,
gracefulShutdown,
getHealthSnapshot,
verboseRequestLogs,
uiPassword,
tunnelAuthController,
readSettingsFromDiskMigrated,
@@ -60,7 +61,7 @@ export const createBootstrapRuntime = (dependencies) => {
getHealthSnapshot,
});
registerCommonRequestMiddleware(app, { express });
registerCommonRequestMiddleware(app, { express, verboseRequestLogs });
const uiAuthController = createUiAuth({
password: uiPassword,
@@ -451,7 +451,7 @@ export const registerSettingsUtilityRoutes = (app, dependencies) => {
};
export const registerCommonRequestMiddleware = (app, dependencies) => {
const { express } = dependencies;
const { express, verboseRequestLogs = false } = dependencies;
app.use((req, res, next) => {
if (req.path.startsWith('/api/behavior')) {
@@ -492,7 +492,9 @@ export const registerCommonRequestMiddleware = (app, dependencies) => {
app.use(express.urlencoded({ extended: true, limit: '50mb' }));
app.use((req, _res, next) => {
console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`);
if (verboseRequestLogs) {
console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`);
}
next();
});
};