fix: graceful per-provider failure handling#316
Open
sloth-of-all-trades wants to merge 1 commit into
Open
Conversation
When a metadata provider fails (403, 500, timeout, Cloudflare block), the error is now caught and logged for that provider only. The search /match / aggregation continues with remaining providers instead of aborting the entire operation with a 500 error. Fixes Snd-R#216
Author
|
@Snd-R could this be merged to improve the overall stability? The current implementation throws an error, and fails the whole search. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a metadata provider fails (403, 500, timeout, Cloudflare block), the error is now caught and logged for that provider only. The search, match, and aggregation operations continue with remaining providers instead of aborting the entire operation with a 500 error.
Problem
When any single provider throws an exception (e.g. BookWalker returns 403 from Cloudflare, AniList rate-limits with 403, MangaUpdates image server 500s), the entire metadata operation aborts and returns a 500 error to the UI. This happens even when the failed provider is not the one being used for identification.
Fixes #216
Changes
Patched
MetadataService.ktin 4 places:searchSeriesMetadata(both overloads): Wrapped each provider async call in try/catch. Failed providers return empty results instead of propagating the exception.matchSeries: Changed fromthrow ProviderExceptionto log the error, emit aProviderErrorEvent, and return null. This allows thefirstNotNullOfOrNullloop to continue to the next provider.getBookMetadata: Changed fromthrow ProviderExceptionto log and return partial metadata (null for failed books) instead of aborting.aggregateMetadataFromProviders: Wrapped each provider async call in try/catch. Failed providers are skipped instead of crashing the aggregation.Testing
Built and deployed on a live Komga instance. BookWalker (Cloudflare-blocked, 403) and AniList (rate-limited, 403) now fail gracefully. Search returns 200 OK with results from remaining providers (VIZ, MangaUpdates, MangaDex, YenPress). No 500 errors.