fix(integrations): resolve intermittent Seerr/Overseerr crashes and add query status to context menu
- Add fallbackToStaleOnError option to createRequestHandler to serve stale cached data when upstream APIs fail transiently - Set cacheTtlMs: 60_000 and fallbackToStaleOnError: true on mediaRequestListRequestHandler to restore pre-v1.69.0 cache duration - Add response.ok check in OverseerrIntegration.getItemInformationAsync - Change Promise.all to Promise.allSettled in getRequestsAsync so a single failing media detail fetch skips that item instead of crashing - Replace WidgetCacheAge with WidgetQueryStatus in the right-click context menu, showing error/success/loading state with age and error message tooltip Fixes #6329
This commit is contained in:
1 parent
a0034b2cfc
commit
643721fc16
7 files changed
+87
-28
No files matched your search
@@ -153,9 +153,9 @@ export class OverseerrIntegration
|
||||
);
|
||||
} else if (pendingResults.length > 0) requests = pendingResults;
|
||||
else if (allResults.length > 0) requests = allResults;
|
||||
else return Promise.all([]);
|
||||
else return [];
|
||||
|
||||
return await Promise.all(
|
||||
const settled = await Promise.allSettled(
|
||||
requests.map(async (request): Promise<MediaRequest> => {
|
||||
const information = await this.getItemInformationAsync(request.media.tmdbId, request.type);
|
||||
|
||||
@@ -184,6 +184,10 @@ export class OverseerrIntegration
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
return settled
|
||||
.filter((result): result is PromiseFulfilledResult<MediaRequest> => result.status === "fulfilled")
|
||||
.map((result) => result.value);
|
||||
}
|
||||
|
||||
protected mapRequestStatus(status: UpstreamMediaRequestStatus): MediaRequestStatus {
|
||||
@@ -301,6 +305,10 @@ export class OverseerrIntegration
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch ${type} information for id ${id}: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
if (type === "tv") {
|
||||
const series = (await response.json()) as TvInformation;
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user