Skip to content

Commit fd2826a

Browse files
authored
Merge pull request ajayyy#2319 from mini-bomba/segment_fetching_try_finally
Actually remove rejected promises from the pendingList
2 parents 06ead87 + 9d48d4e commit fd2826a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils/segmentData.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ export async function getSegmentsForVideo(videoID: VideoID, ignoreCache: boolean
3737
const pendingData = fetchSegmentsForVideo(videoID);
3838
pendingList[videoID] = pendingData;
3939

40-
const result = await pendingData;
41-
delete pendingList[videoID];
40+
let result: Awaited<typeof pendingData>;
41+
try {
42+
result = await pendingData;
43+
} finally {
44+
delete pendingList[videoID];
45+
}
4246

4347
return result;
4448
}

0 commit comments

Comments
 (0)