Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

mark

Manav Rathifae47f102e94
diff --git a/desktop/src/main/services/ffmpeg-worker.ts b/desktop/src/main/services/ffmpeg-worker.ts
index f6af11358c..c186f0a32b 100644
--- a/desktop/src/main/services/ffmpeg-worker.ts
+++ b/desktop/src/main/services/ffmpeg-worker.ts
@@ -798,8 +798,8 @@ const uploadVideoSegments = async (
// Success.
return;
}
- if (res.status >= 400 && res.status < 500) {
- // HTTP 4xx.
+ if (res.status >= 400 && res.status < 500 && res.status != 429) {
+ // HTTP 4xx, except potentially transient 429 rate limits.
abort = true;
}
throw new Error(
diff --git a/web/packages/gallery/services/video.ts b/web/packages/gallery/services/video.ts
index 389b6902c9..a013baf973 100644
--- a/web/packages/gallery/services/video.ts
+++ b/web/packages/gallery/services/video.ts
@@ -25,6 +25,7 @@ import {
initiateGenerateHLS,
readVideoStream,
videoStreamDone,
+ type GenerateHLSResult,
} from "../utils/native-stream";
import { downloadManager, isNetworkDownloadError } from "./download";
import {
@@ -802,12 +803,24 @@ const processQueueItem = async ({
log.info(`Generate HLS for ${fileLogID(file)} | start`);
- // TODO(HLS): Inside this needs to be more granular in case of errors.
- const res = await initiateGenerateHLS(
- electron,
- sourceVideo,
- objectUploadURL,
- );
+ let res: GenerateHLSResult | undefined;
+ try {
+ res = await initiateGenerateHLS(electron, sourceVideo, objectUploadURL);
+ } catch (e) {
+ // Failures during stream generation on the native side are expected to
+ // happen in two cases:
+ //
+ // 1. There is something specific to this video that doesn't work with
+ // the current HLS generation pipeline (the ffmpeg invocation).
+ //
+ // 2. The upload of the generated video fails.
+ //
+ // The native side code already retries failures for case 2 (except HTTP
+ // 4xx errors). Thus, usually we should come here only for case 1, and
+ // retrying the same video again will not work either.
+ await markFailedVideoFileID(file.id);
+ throw e;
+ }
if (!res) {
log.info(`Generate HLS for ${fileLogID(file)} | not-required`);