Skip to content

Commit ad6d44b

Browse files
Increase timeout for video endpoint specifically
1 parent ffd7231 commit ad6d44b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/endpoints/video.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export async function getVideo(request: IRequest) {
1212
}
1313

1414
const path = url.pathname.substring('/v'.length);
15-
const video = await get_packaged_video(path);
15+
const video = await get_packaged_video(path, 5000);
1616
if (video) {
1717
const videoUrl = video.url;
1818
const headers = { 'Location': videoUrl, 'content-type': 'text/html' };

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ export function fallbackRedirect(req: IRequest) {
5454
});
5555
}
5656

57-
export async function get_packaged_video(path: string) {
57+
export async function get_packaged_video(path: string, timeout = 1000) {
5858
try {
5959
const url = new URL(`https://www.reddit.com${path}`);
6060
const html = await fetch(url, {
61-
signal: AbortSignal.timeout(1000),
61+
signal: AbortSignal.timeout(timeout),
6262
headers: {
6363
'User-Agent': USER_AGENT,
6464
},

0 commit comments

Comments
 (0)