@@ -49,6 +49,12 @@ const MEMEX_BASE_URL = "https://memex.tlon.network";
4949/** Max bytes to read from the Memex upload JSON response. */
5050const MEMEX_UPLOAD_RESPONSE_MAX_BYTES = 64 * 1024 ;
5151
52+ /** Timeout for the Memex upload URL lookup request. */
53+ const TLON_MEMEX_UPLOAD_URL_TIMEOUT_MS = 30_000 ;
54+
55+ /** Timeout for the actual file upload to Memex or a custom S3 target. */
56+ const TLON_UPLOAD_TIMEOUT_MS = 120_000 ;
57+
5258let currentClientConfig : ClientConfig | null = null ;
5359
5460export function configureClient ( params : ClientConfig ) : void {
@@ -250,6 +256,7 @@ async function getMemexUploadUrl(params: {
250256 auditContext : "tlon-memex-upload-url" ,
251257 capture : false ,
252258 maxRedirects : 0 ,
259+ timeoutMs : TLON_MEMEX_UPLOAD_URL_TIMEOUT_MS ,
253260 } ) ;
254261 release = guarded . release ;
255262 if ( ! guarded . response . ok ) {
@@ -317,6 +324,7 @@ export async function uploadFile(params: UploadFileParams): Promise<UploadResult
317324 auditContext : "tlon-memex-upload" ,
318325 capture : false ,
319326 maxRedirects : 0 ,
327+ timeoutMs : TLON_UPLOAD_TIMEOUT_MS ,
320328 } ) ;
321329 release = guarded . release ;
322330 assertTrustedMemexUploadUrl ( guarded . finalUrl , "Memex final upload URL" ) ;
@@ -381,6 +389,7 @@ export async function uploadFile(params: UploadFileParams): Promise<UploadResult
381389 capture : false ,
382390 maxRedirects : 0 ,
383391 policy : privateNetworkPolicy ,
392+ timeoutMs : TLON_UPLOAD_TIMEOUT_MS ,
384393 } ) ;
385394 release = guarded . release ;
386395 if ( ! guarded . response . ok ) {
0 commit comments