File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coer
1414const MAX_IMAGES_PER_MESSAGE = 8 ;
1515const TLON_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS = 30_000 ;
1616
17+ /** Overall request timeout for remote media fetches that are idle before any data. */
18+ const TLON_MEDIA_DOWNLOAD_TIMEOUT_MS = 120_000 ;
19+
1720interface ExtractedImage {
1821 url : string ;
1922 alt ?: string ;
@@ -70,6 +73,7 @@ export async function downloadMedia(
7073 const fetchOptions = {
7174 url,
7275 maxBytes : MAX_IMAGE_BYTES ,
76+ timeoutMs : TLON_MEDIA_DOWNLOAD_TIMEOUT_MS ,
7377 readIdleTimeoutMs : TLON_MEDIA_DOWNLOAD_IDLE_TIMEOUT_MS ,
7478 ssrfPolicy : undefined ,
7579 requestInit : { method : "GET" } ,
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ import { uploadFile } from "../tlon-api.js";
66
77const TLON_UPLOAD_IMAGE_IDLE_TIMEOUT_MS = 30_000 ;
88
9+ /** Overall request timeout for image upload fetches that are idle before any data. */
10+ const TLON_UPLOAD_IMAGE_TIMEOUT_MS = 120_000 ;
11+
912/**
1013 * Fetch an image from a URL and upload it to Tlon storage.
1114 * Returns the uploaded URL, or falls back to the original URL on error.
@@ -24,6 +27,7 @@ export async function uploadImageFromUrl(imageUrl: string): Promise<string> {
2427 const fetched = await readRemoteMediaBuffer ( {
2528 url : imageUrl ,
2629 maxBytes : MAX_IMAGE_BYTES ,
30+ timeoutMs : TLON_UPLOAD_IMAGE_TIMEOUT_MS ,
2731 readIdleTimeoutMs : TLON_UPLOAD_IMAGE_IDLE_TIMEOUT_MS ,
2832 ssrfPolicy : undefined ,
2933 requestInit : { method : "GET" } ,
You can’t perform that action at this time.
0 commit comments