Skip to content

Commit b85960b

Browse files
committed
updated to fix no break condition on loop and to use the same number of retries and delay as the glama provider (for consistency)
Signed-off-by: James Barker <[email protected]>
1 parent 9c480aa commit b85960b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/api/providers/openrouter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ export class OpenRouterHandler implements ApiHandler, SingleCompletionHandler {
184184
}
185185

186186
// retry fetching generation details
187-
let retries = 0
188-
while (retries < 3) {
189-
await delay(500) // FIXME: necessary delay to ensure generation endpoint is ready
187+
let attempt = 0
188+
while (attempt++ < 10) {
189+
await delay(200) // FIXME: necessary delay to ensure generation endpoint is ready
190190
try {
191191
const response = await axios.get(`https://openrouter.ai/api/v1/generation?id=${genId}`, {
192192
headers: {
@@ -207,6 +207,7 @@ export class OpenRouterHandler implements ApiHandler, SingleCompletionHandler {
207207
totalCost: generation?.total_cost || 0,
208208
fullResponseText,
209209
} as OpenRouterApiStreamUsageChunk
210+
return
210211
} catch (error) {
211212
// ignore if fails
212213
console.error("Error fetching OpenRouter generation details:", error)

0 commit comments

Comments
 (0)