feat: add caching debug logs and configurable max concurrent requests for Komga API to enhance performance monitoring

This commit is contained in:
Julien Froidefond
2025-10-18 09:08:41 +02:00
parent ae4b766085
commit b7704207ec
42 changed files with 1141 additions and 1302 deletions

23
src/utils/image-errors.ts Normal file
View File

@@ -0,0 +1,23 @@
import { AppError } from "./errors";
import { ERROR_CODES } from "@/constants/errorCodes";
/**
* Helper pour trouver le status HTTP dans la chaîne d'erreurs imbriquées
* Parcourt récursivement les originalError pour trouver une erreur KOMGA.HTTP_ERROR
*/
export function findHttpStatus(error: unknown): number | null {
if (!(error instanceof AppError)) return null;
// Si c'est une erreur HTTP, récupérer le status
if (error.code === ERROR_CODES.KOMGA.HTTP_ERROR) {
return (error.params as any)?.status || null;
}
// Sinon, chercher récursivement dans originalError
if (error.originalError) {
return findHttpStatus(error.originalError);
}
return null;
}