Browse Source

adding timeout (#7128)

Spoon 1 month ago
parent
commit
32e0b612d9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/opencode/src/session/system.ts

+ 1 - 1
packages/opencode/src/session/system.ts

@@ -123,7 +123,7 @@ export namespace SystemPrompt {
         .then((x) => "Instructions from: " + p + "\n" + x),
         .then((x) => "Instructions from: " + p + "\n" + x),
     )
     )
     const foundUrls = urls.map((url) =>
     const foundUrls = urls.map((url) =>
-      fetch(url)
+      fetch(url, { signal: AbortSignal.timeout(5000) })
         .then((res) => (res.ok ? res.text() : ""))
         .then((res) => (res.ok ? res.text() : ""))
         .catch(() => "")
         .catch(() => "")
         .then((x) => (x ? "Instructions from: " + url + "\n" + x : "")),
         .then((x) => (x ? "Instructions from: " + url + "\n" + x : "")),