fix: exempt health endpoint from rate limiting
All checks were successful
ci/woodpecker/push/api Pipeline was successful
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Docker/load-balancer health probes hit GET /health every ~5s from 127.0.0.1, exhausting the rate limit and causing all subsequent checks to return 429 — making the service appear unhealthy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { Controller, Get } from "@nestjs/common";
|
import { Controller, Get } from "@nestjs/common";
|
||||||
|
import { SkipThrottle } from "@nestjs/throttler";
|
||||||
import { AppService } from "./app.service";
|
import { AppService } from "./app.service";
|
||||||
import { PrismaService } from "./prisma/prisma.service";
|
import { PrismaService } from "./prisma/prisma.service";
|
||||||
import type { ApiResponse, HealthStatus } from "@mosaic/shared";
|
import type { ApiResponse, HealthStatus } from "@mosaic/shared";
|
||||||
@@ -17,6 +18,7 @@ export class AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get("health")
|
@Get("health")
|
||||||
|
@SkipThrottle()
|
||||||
async getHealth(): Promise<ApiResponse<HealthStatus>> {
|
async getHealth(): Promise<ApiResponse<HealthStatus>> {
|
||||||
const dbHealthy = await this.prisma.isHealthy();
|
const dbHealthy = await this.prisma.isHealthy();
|
||||||
const dbInfo = await this.prisma.getConnectionInfo();
|
const dbInfo = await this.prisma.getConnectionInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user