From 9619e9528331a33d1ae0784e5fe9e748983ca78c Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sun, 26 Sep 2021 11:11:08 -0400 Subject: [PATCH] Don't use cache when no successful submissions exist --- src/routes/postSkipSegments.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index 5420271..7e8fa53 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -461,8 +461,8 @@ async function updateDataIfVideoDurationChange(videoID: VideoID, service: string let apiVideoInfo: APIVideoInfo = null; if (service == Service.YouTube) { - // Don't use cache if we don't know the video duraton, or the client claims that it has changed - apiVideoInfo = await getYouTubeVideoInfo(videoID, !videoDurationParam || videoDurationChanged(videoDurationParam)); + // Don't use cache if we don't know the video duration, or the client claims that it has changed + apiVideoInfo = await getYouTubeVideoInfo(videoID, !videoDurationParam || previousSubmissions.length === 0 || videoDurationChanged(videoDurationParam)); } const apiVideoDuration = apiVideoInfo?.data?.lengthSeconds as VideoDuration; if (!videoDurationParam || (apiVideoDuration && Math.abs(videoDurationParam - apiVideoDuration) > 2)) {