Add health check and retry logic and circuit breaker

This commit is contained in:
SepehrYahyaee
2026-09-28 17:01:53 +03:30
parent 22371f4a03
commit 03fa5e0f20
67 changed files with 3101 additions and 410 deletions
+25
View File
@@ -198,6 +198,26 @@ export const ERROR_CATALOG = {
message: 'User rate limit exceeded',
messageFa: 'تعداد درخواست‌های مجاز کاربر به پایان رسیده است',
},
IDEMPOTENCY_KEY_REUSED: {
status: HttpStatus.CONFLICT,
message: 'Idempotency key was already used with a different request body',
messageFa: 'کلید idempotency قبلا با بدنه درخواست دیگری استفاده شده است',
},
IDEMPOTENCY_REQUEST_IN_PROGRESS: {
status: HttpStatus.CONFLICT,
message: 'An identical request is already in progress',
messageFa: 'درخواست مشابهی در حال پردازش است',
},
PROVIDER_CIRCUIT_OPEN: {
status: HttpStatus.SERVICE_UNAVAILABLE,
message: 'Provider is temporarily unavailable',
messageFa: 'سرویس‌دهنده موقتا در دسترس نیست',
},
PROVIDER_BULKHEAD_FULL: {
status: HttpStatus.SERVICE_UNAVAILABLE,
message: 'Provider is currently at capacity',
messageFa: 'ظرفیت همزمان سرویس‌دهنده تکمیل است',
},
SHAHKAR_NO_MATCH: {
status: HttpStatus.OK,
message: 'No match found between the provided national code and mobile number',
@@ -218,6 +238,11 @@ export const ERROR_CATALOG = {
message: 'Request failed',
messageFa: 'درخواست ناموفق بود',
},
INQUIRY_LOG_PURGE_DISABLED: {
status: HttpStatus.FORBIDDEN,
message: 'Inquiry log purge is disabled',
messageFa: 'پاک‌سازی گزارش‌های استعلام غیرفعال است',
},
} as const satisfies Record<string, ErrorCatalogEntry>;
export type AppErrorCode = keyof typeof ERROR_CATALOG;