From ea4ec26683fa3bf19b19379c7632e446d1223cc0 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 2 Mar 2023 13:31:16 -0600 Subject: Increase network timeouts (closes #248) (#249) * Increase network timeouts (close #248) * Fix: on post error only update the ext link card if it's in use --- src/lib/api/api-polyfill.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/api/api-polyfill.ts') diff --git a/src/lib/api/api-polyfill.ts b/src/lib/api/api-polyfill.ts index 3b5ba7518..b7be6913a 100644 --- a/src/lib/api/api-polyfill.ts +++ b/src/lib/api/api-polyfill.ts @@ -1,7 +1,8 @@ import AtpAgent from '@atproto/api' import RNFS from 'react-native-fs' -const TIMEOUT = 10e3 // 10s +const GET_TIMEOUT = 15e3 // 15s +const POST_TIMEOUT = 60e3 // 60s export function doPolyfill() { AtpAgent.configure({fetch: fetchHandler}) @@ -43,7 +44,10 @@ async function fetchHandler( } const controller = new AbortController() - const to = setTimeout(() => controller.abort(), TIMEOUT) + const to = setTimeout( + () => controller.abort(), + reqMethod === 'post' ? POST_TIMEOUT : GET_TIMEOUT, + ) const res = await fetch(reqUri, { method: reqMethod, -- cgit 1.4.1