(webhookId: string, logger: Logger)
| 54 | |
| 55 | /** Reset the webhook's failure count on successful poll. */ |
| 56 | export async function markWebhookSuccess(webhookId: string, logger: Logger): Promise<void> { |
| 57 | try { |
| 58 | await db |
| 59 | .update(webhook) |
| 60 | .set({ |
| 61 | failedCount: 0, |
| 62 | updatedAt: new Date(), |
| 63 | }) |
| 64 | .where( |
| 65 | and(eq(webhook.id, webhookId), or(isNull(webhook.failedCount), ne(webhook.failedCount, 0))) |
| 66 | ) |
| 67 | } catch (err) { |
| 68 | logger.error(`Failed to mark webhook ${webhookId} as successful:`, err) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | /** Fetch all active webhooks for a provider, joined with their workflow. */ |
| 73 | export async function fetchActiveWebhooks( |
no test coverage detected