mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 03:56:54 -06:00
feat(webhook): adicionar interface para configuração de timeout e retry
Adiciona interface de configuração na estrutura Webhook para permitir: - Configuração de timeout em requisições - Parâmetros de retentativas configuráveis - Lista de códigos HTTP que não devem gerar retry Issue: #1325
This commit is contained in:
parent
427c994993
commit
a2c25bb6f6
@ -220,7 +220,21 @@ export type CacheConfLocal = {
|
|||||||
TTL: number;
|
TTL: number;
|
||||||
};
|
};
|
||||||
export type SslConf = { PRIVKEY: string; FULLCHAIN: string };
|
export type SslConf = { PRIVKEY: string; FULLCHAIN: string };
|
||||||
export type Webhook = { GLOBAL?: GlobalWebhook; EVENTS: EventsWebhook };
|
export type Webhook = {
|
||||||
|
GLOBAL?: GlobalWebhook;
|
||||||
|
EVENTS: EventsWebhook;
|
||||||
|
REQUEST?: {
|
||||||
|
TIMEOUT_MS?: number;
|
||||||
|
};
|
||||||
|
RETRY?: {
|
||||||
|
MAX_ATTEMPTS?: number;
|
||||||
|
INITIAL_DELAY_SECONDS?: number;
|
||||||
|
USE_EXPONENTIAL_BACKOFF?: boolean;
|
||||||
|
MAX_DELAY_SECONDS?: number;
|
||||||
|
JITTER_FACTOR?: number;
|
||||||
|
NON_RETRYABLE_STATUS_CODES?: number[];
|
||||||
|
};
|
||||||
|
};
|
||||||
export type Pusher = { ENABLED: boolean; GLOBAL?: GlobalPusher; EVENTS: EventsPusher };
|
export type Pusher = { ENABLED: boolean; GLOBAL?: GlobalPusher; EVENTS: EventsPusher };
|
||||||
export type ConfigSessionPhone = { CLIENT: string; NAME: string; VERSION: string };
|
export type ConfigSessionPhone = { CLIENT: string; NAME: string; VERSION: string };
|
||||||
export type QrCode = { LIMIT: number; COLOR: string };
|
export type QrCode = { LIMIT: number; COLOR: string };
|
||||||
@ -497,6 +511,17 @@ export class ConfigService {
|
|||||||
ERRORS: process.env?.WEBHOOK_EVENTS_ERRORS === 'true',
|
ERRORS: process.env?.WEBHOOK_EVENTS_ERRORS === 'true',
|
||||||
ERRORS_WEBHOOK: process.env?.WEBHOOK_EVENTS_ERRORS_WEBHOOK || '',
|
ERRORS_WEBHOOK: process.env?.WEBHOOK_EVENTS_ERRORS_WEBHOOK || '',
|
||||||
},
|
},
|
||||||
|
REQUEST: {
|
||||||
|
TIMEOUT_MS: Number.parseInt(process.env?.WEBHOOK_REQUEST_TIMEOUT_MS) || 30000,
|
||||||
|
},
|
||||||
|
RETRY: {
|
||||||
|
MAX_ATTEMPTS: Number.parseInt(process.env?.WEBHOOK_RETRY_MAX_ATTEMPTS) || 10,
|
||||||
|
INITIAL_DELAY_SECONDS: Number.parseInt(process.env?.WEBHOOK_RETRY_INITIAL_DELAY_SECONDS) || 5,
|
||||||
|
USE_EXPONENTIAL_BACKOFF: process.env?.WEBHOOK_RETRY_USE_EXPONENTIAL_BACKOFF !== 'false',
|
||||||
|
MAX_DELAY_SECONDS: Number.parseInt(process.env?.WEBHOOK_RETRY_MAX_DELAY_SECONDS) || 300,
|
||||||
|
JITTER_FACTOR: Number.parseFloat(process.env?.WEBHOOK_RETRY_JITTER_FACTOR) || 0.2,
|
||||||
|
NON_RETRYABLE_STATUS_CODES: process.env?.WEBHOOK_RETRY_NON_RETRYABLE_STATUS_CODES?.split(',').map(Number) || [400, 401, 403, 404, 422],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
CONFIG_SESSION_PHONE: {
|
CONFIG_SESSION_PHONE: {
|
||||||
CLIENT: process.env?.CONFIG_SESSION_PHONE_CLIENT || 'Evolution API',
|
CLIENT: process.env?.CONFIG_SESSION_PHONE_CLIENT || 'Evolution API',
|
||||||
|
Loading…
Reference in New Issue
Block a user