fix: Health-Check vereinfacht – kein DB-Query mehr bei /health
Build & Deploy Tippspiel / build (push) Successful in 30s
Build & Deploy Tippspiel / build (push) Successful in 30s
Verhindert unnötige SELECT 1 Abfragen gegen Supabase alle 30s. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import rateLimit from 'express-rate-limit';
|
|||||||
|
|
||||||
import { staffbaseAuth as createStaffbaseAuth } from './middleware/staffbaseAuth';
|
import { staffbaseAuth as createStaffbaseAuth } from './middleware/staffbaseAuth';
|
||||||
import { devAuth } from './middleware/devAuth';
|
import { devAuth } from './middleware/devAuth';
|
||||||
import { checkDbConnection } from './db/client';
|
|
||||||
import { logger } from './services/logger';
|
import { logger } from './services/logger';
|
||||||
|
|
||||||
import matchesRouter from './routes/matches';
|
import matchesRouter from './routes/matches';
|
||||||
@@ -110,11 +109,9 @@ app.use(
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
// Health Check (ohne Auth – für Railway/Render/Uptime-Monitoring)
|
// Health Check (ohne Auth – für Railway/Render/Uptime-Monitoring)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
app.get('/health', async (_req, res) => {
|
app.get('/health', (_req, res) => {
|
||||||
const dbOk = await checkDbConnection();
|
res.status(200).json({
|
||||||
res.status(dbOk ? 200 : 503).json({
|
status: 'ok',
|
||||||
status: dbOk ? 'ok' : 'degraded',
|
|
||||||
db: dbOk ? 'connected' : 'unreachable',
|
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
version: process.env.npm_package_version ?? '1.0.0',
|
version: process.env.npm_package_version ?? '1.0.0',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user