kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: make retry at capacity a little more customizable
rodzic
df424df197
commit
71de95ab97
|
@ -351,13 +351,16 @@ async function checkForChatGPTAtCapacity(
|
||||||
page: Page,
|
page: Page,
|
||||||
opts: {
|
opts: {
|
||||||
timeoutMs?: number
|
timeoutMs?: number
|
||||||
|
pollingIntervalMs?: number
|
||||||
retries?: number
|
retries?: number
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
const {
|
const {
|
||||||
timeoutMs = 2 * 60 * 1000, // 2 minutes
|
timeoutMs = 2 * 60 * 1000, // 2 minutes
|
||||||
|
pollingIntervalMs = 3000,
|
||||||
retries = 10
|
retries = 10
|
||||||
} = opts
|
} = opts
|
||||||
|
|
||||||
// console.log('checkForChatGPTAtCapacity', page.url())
|
// console.log('checkForChatGPTAtCapacity', page.url())
|
||||||
let isAtCapacity = false
|
let isAtCapacity = false
|
||||||
let numTries = 0
|
let numTries = 0
|
||||||
|
@ -378,7 +381,7 @@ async function checkForChatGPTAtCapacity(
|
||||||
timeout: timeoutMs
|
timeout: timeoutMs
|
||||||
})
|
})
|
||||||
|
|
||||||
await delay(2000)
|
await delay(pollingIntervalMs)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// ignore errors likely due to navigation
|
// ignore errors likely due to navigation
|
||||||
|
|
Ładowanie…
Reference in New Issue