From bf24d1577fe631aac183a721fd51a11d6199593c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Thu, 9 Jul 2026 10:36:17 +0400 Subject: [PATCH] =?UTF-8?q?Fix:=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B0=D1=83?= =?UTF-8?q?=D1=82=2010=D1=81=20=D0=BD=D0=B0=20=D0=B2=D1=81=D0=B5=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D1=8B=20=E2=80=94=20=D0=BD=D0=B5?= =?UTF-8?q?=20=D0=B2=D0=B8=D1=81=D0=B8=D0=BC,=20=D0=BD=D0=B5=20=D0=B4?= =?UTF-8?q?=D0=B0=D1=91=D0=BC=20nginx=20503.=20=D0=92=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D1=8F=200.1.25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- server.js | 11 +++++++++++ v2/src/config/index.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 18d15e3..096b2f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipwhitelist", - "version": "0.1.24", + "version": "0.1.25", "description": "IP WhiteList microservice for cloud provider", "main": "server.js", "scripts": { diff --git a/server.js b/server.js index d4d22ef..3b8a9b8 100644 --- a/server.js +++ b/server.js @@ -57,6 +57,17 @@ app.use(cookieParser()); async function start() { const auth = await initAuth(); + // ── Стоп-кран: если запрос висит > 10 сек — обрываем с ошибкой ─────── + app.use((req, res, next) => { + const timer = setTimeout(() => { + if (!res.headersSent) { + res.status(503).type('html').send('

Сервис временно недоступен

Превышено время ожидания

'); + } + }, 10000); + res.on('finish', () => clearTimeout(timer)); + next(); + }); + // ── Сессии ──────────────────────────────────────────────────────────────── const { pool } = require('./src/db'); app.use(createSessionMiddleware(pool)); diff --git a/v2/src/config/index.js b/v2/src/config/index.js index cc173f3..21eeacf 100644 --- a/v2/src/config/index.js +++ b/v2/src/config/index.js @@ -8,7 +8,7 @@ // ═══════════════════════════════════════════════════════════════════════════════ module.exports = { - version: '0.1.24', + version: '0.1.25', // ── Среда ───────────────────────────────────────────────────────────────── // APP_ENV=test → тестовый стенд (жёлтый баннер в UI, можно включать тестовый API)