From 71de95ab973543c7252217ea4a84615645d69d64 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Sat, 17 Dec 2022 16:33:39 -0600 Subject: [PATCH] feat: make retry at capacity a little more customizable --- src/openai-auth.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openai-auth.ts b/src/openai-auth.ts index fc3999c..0581f40 100644 --- a/src/openai-auth.ts +++ b/src/openai-auth.ts @@ -351,13 +351,16 @@ async function checkForChatGPTAtCapacity( page: Page, opts: { timeoutMs?: number + pollingIntervalMs?: number retries?: number } = {} ) { const { timeoutMs = 2 * 60 * 1000, // 2 minutes + pollingIntervalMs = 3000, retries = 10 } = opts + // console.log('checkForChatGPTAtCapacity', page.url()) let isAtCapacity = false let numTries = 0 @@ -378,7 +381,7 @@ async function checkForChatGPTAtCapacity( timeout: timeoutMs }) - await delay(2000) + await delay(pollingIntervalMs) } } catch (err) { // ignore errors likely due to navigation