From ce7d0a1908d7389f2621cd1231ea31521c6c25b0 Mon Sep 17 00:00:00 2001 From: cauta Date: Thu, 30 May 2024 16:25:26 +0700 Subject: [PATCH] allow config webhook retry on create monitor --- app/libs/shared_modules/src/webhook/webhook.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/libs/shared_modules/src/webhook/webhook.service.ts b/app/libs/shared_modules/src/webhook/webhook.service.ts index 4da01b9..2d89e50 100644 --- a/app/libs/shared_modules/src/webhook/webhook.service.ts +++ b/app/libs/shared_modules/src/webhook/webhook.service.ts @@ -36,6 +36,7 @@ export class WebhookService { webhookUrl: string, secret_token: string, authorization: string, + retry?: number, ): Promise { const createWebhookDto = { name: name, @@ -45,7 +46,7 @@ export class WebhookService { secret_token: secret_token, authorization_token: authorization, active: true, - max_delivery_attempts: MAX_ATTEMPT, + max_delivery_attempts: retry || MAX_ATTEMPT, delivery_attempt_timeout: MAX_TIMEOUT, retry_min_backoff: 10, retry_max_backoff: 60, @@ -125,6 +126,7 @@ export class WebhookService { authorization: string; secret_token: string; active: boolean; + retry?: number; }, ) { try { @@ -134,6 +136,7 @@ export class WebhookService { options.authorization, options.secret_token, options.active, + options.retry, ); const response = await sendPut( `${this.webhookUrl}/v1/webhooks/${webhookId}`, @@ -282,6 +285,7 @@ export class WebhookService { authorization: string, secret_token: string, active: boolean, + retry: number, ): UpdateWebhookRequestDto { const updateWebhookDto = { name: name, @@ -291,7 +295,7 @@ export class WebhookService { secret_token: secret_token, authorization_token: authorization, active: active, - max_delivery_attempts: MAX_ATTEMPT, + max_delivery_attempts: retry || MAX_ATTEMPT, delivery_attempt_timeout: MAX_TIMEOUT, retry_min_backoff: 10, retry_max_backoff: 60,