mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
fix(metadata): stop comicvine searches timing out into no results
Every comicvine search probed up to eight candidate volumes one request at a time, each holding a one second rate limiter slot against an endpoint that answers in three to four seconds, so the fifteen second provider budget ran out before the right volume was reached and the search reported an empty result. Rank volumes on the name and issue count already carried by the volume search response, then probe them in concurrent waves, so the runs that can hold the issue are tried first and within budget. Bind the work to a soft deadline that aborts requests still in flight. Reaching it now yields the candidates already found, rather than letting a late detail lookup cross the hard timeout and take everything with it. A probe or detail lookup that fails or is throttled costs its own result only, never its siblings or the candidate it was enriching. Take the series name from a query the user actually typed instead of the stored one, or searching a comic for a different series silently returned the series it was already filed under. Strip the zero padding comic filenames add to issue numbers in the provider rather than only in the search controller, so the background refresh path benefits too. Report a provider that timed out, was throttled, or failed as its own stream event, since all three were indistinguishable from a genuinely empty result. Candidates keep the default event and an unchanged payload, so a client has to read the event name to tell the two apart. Fixes #1039
This commit is contained in:
@@ -100,6 +100,20 @@ export interface MetadataProviderInfo {
|
||||
selectedByFieldRules?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* SSE event name carrying a MetadataProviderSearchStatus. Candidates keep the default event, so a
|
||||
* client that only reads candidates is unaffected by a provider reporting how it stopped.
|
||||
*/
|
||||
export const METADATA_PROVIDER_STATUS_EVENT = "provider-status";
|
||||
|
||||
/** Why a provider stopped before finishing, so an interrupted search is not read as an empty one. */
|
||||
export type MetadataProviderSearchOutcome = "timeout" | "throttled" | "failed";
|
||||
|
||||
export interface MetadataProviderSearchStatus {
|
||||
provider: MetadataProviderKey;
|
||||
outcome: MetadataProviderSearchOutcome;
|
||||
}
|
||||
|
||||
export type MetadataFetchEmptyReason = "no_active_providers" | "providers_throttled" | "no_candidates" | "no_resolved_fields";
|
||||
|
||||
export interface MetadataFetchDiagnostics {
|
||||
|
||||
Reference in New Issue
Block a user