⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
fix(api): clear the failure counter when a webhook is switched back on (#298)
Ahmad Othman Ammar Adi927f471f37d7
diff --git a/apps/api/src/modules/webhooks/service.ts b/apps/api/src/modules/webhooks/service.tsindex 8e5fec64..0b3bd030 100644--- a/apps/api/src/modules/webhooks/service.ts+++ b/apps/api/src/modules/webhooks/service.ts@@ -100,6 +100,11 @@ export async function updateWebhook(if (patch.url !== undefined) set.url = patch.url;if (patch.events !== undefined) set.events = patch.events;if (patch.isActive !== undefined) set.isActive = patch.isActive;+ // The worker keeps a webhook active while its consecutive failures stay under the+ // disable threshold, and clears that counter only on a delivery that succeeds. A+ // webhook switched back on therefore starts at the threshold, and its next failed+ // attempt disables it again, so turning it on clears the counter with it.+ if (patch.isActive === true) set.consecutiveFailures = 0;if (Object.keys(set).length === 0) return getWebhook(id);const [row] = await db.update(webhook).set(set).where(eq(webhook.id, id)).returning();return row ? mapWebhook(row) : null;