mirror of
https://github.com/hanzoai/dataroom.git
synced 2026-10-30 18:41:07 +00:00
hanzo-build-linux-amd64 is the only ARC runner pool installed on hanzo-k8s today (arm64 pool is paused until DigitalOcean ships arm64 droplets, per ~/work/hanzo/.github/RUNNERS.md). The arm64 job was waiting on spark-hanzoai-arm64 — not provisioned in this cluster — so every build sat in queue forever and the amd64 leg got cancelled. Set platforms: linux/amd64 on the reusable build call to skip arm64 entirely. Re-add arm64 if/when DO ships arm64 droplets and the spark runner pool comes back online.
33 lines
853 B
TypeScript
33 lines
853 B
TypeScript
import { ratelimit } from "@/lib/redis";
|
|
|
|
/**
|
|
* Simple rate limiters for core endpoints
|
|
*/
|
|
export const rateLimiters = {
|
|
// 10 auth attempts per 20 minutes per IP
|
|
auth: ratelimit(10, "20 m"),
|
|
|
|
// 10 billing operations per 20 minutes per IP
|
|
billing: ratelimit(10, "20 m"),
|
|
};
|
|
|
|
/**
|
|
* Apply rate limiting with error handling
|
|
*/
|
|
export async function checkRateLimit(
|
|
limiter: ReturnType<typeof ratelimit>,
|
|
identifier: string,
|
|
): Promise<{ success: boolean; remaining?: number; error?: string }> {
|
|
try {
|
|
const result = await limiter.limit(identifier);
|
|
return {
|
|
success: result.success,
|
|
remaining: result.remaining,
|
|
};
|
|
} catch (error) {
|
|
console.error("Rate limiting error:", error);
|
|
// Fail open - allow request if rate limiting fails
|
|
return { success: true, error: "Rate limiting unavailable" };
|
|
}
|
|
}
|