fix: lock heartbeat every 10s, timeout after 30s (was 2min/5min)

This commit is contained in:
BOHA
2026-03-24 11:24:51 +01:00
parent 9e6ce4359a
commit 3bc7fb6800
2 changed files with 2 additions and 2 deletions

View File

@@ -267,7 +267,7 @@ export default function OfferDetail() {
heartbeatRef.current = setInterval(() => { heartbeatRef.current = setInterval(() => {
apiFetch(`${API_BASE}/offers/${id}/heartbeat`, { method: 'POST' }).catch(() => {}) apiFetch(`${API_BASE}/offers/${id}/heartbeat`, { method: 'POST' }).catch(() => {})
}, 2 * 60 * 1000) // every 2 minutes }, 10 * 1000) // every 10 seconds
return () => { return () => {
if (heartbeatRef.current) clearInterval(heartbeatRef.current) if (heartbeatRef.current) clearInterval(heartbeatRef.current)

View File

@@ -17,7 +17,7 @@ import {
getNextOfferNumber, getNextOfferNumber,
} from '../../services/offers.service'; } from '../../services/offers.service';
const LOCK_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes — lock expires if no heartbeat const LOCK_TIMEOUT_MS = 30 * 1000; // 30 seconds — lock expires if no heartbeat
export default async function quotationsRoutes(fastify: FastifyInstance): Promise<void> { export default async function quotationsRoutes(fastify: FastifyInstance): Promise<void> {