mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-25 08:32:45 +00:00
fix(studio): a cancelled media read is not retried or logged as a failed fetch (#8589)
This commit is contained in:
@@ -51,6 +51,12 @@ describe("mediaUrlSourceOptions", () => {
|
||||
await expect(mediaUrlSourceOptions("probe").fetchFn(URL_WITH_PATH)).rejects.toBe(abort);
|
||||
});
|
||||
|
||||
it("never retries a read that was cancelled, so a cancel is not logged as a failed fetch", () => {
|
||||
const { getRetryDelay } = mediaUrlSourceOptions("probe");
|
||||
|
||||
expect(getRetryDelay(1, new DOMException("Media reads cancelled", "AbortError"))).toBeNull();
|
||||
});
|
||||
|
||||
it("retries a network failure twice, then gives up and records the retries", () => {
|
||||
const { getRetryDelay } = mediaUrlSourceOptions("probe");
|
||||
const failure = new MediaFetchError("probe", null, "TypeError");
|
||||
|
||||
@@ -194,6 +194,7 @@ export function mediaUrlSourceOptions(reader: MediaReader) {
|
||||
return typedResponse(response, asked, request);
|
||||
};
|
||||
const getRetryDelay = (_previousAttempts: number, error: unknown): number | null => {
|
||||
if (isAbort(error)) return null;
|
||||
const start = error instanceof MediaFetchError ? error.start : null;
|
||||
const failed = failuresByStart.get(start) ?? 0;
|
||||
const clientError =
|
||||
|
||||
Reference in New Issue
Block a user