mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: change default timeout
This commit is contained in:
parent
23b16a7f85
commit
ca83acb3c7
3 changed files with 9 additions and 7 deletions
|
|
@ -62,5 +62,7 @@ export const Config = {
|
|||
proxy: PROXY,
|
||||
debug: false,
|
||||
// 各个地方的默认超时时间
|
||||
defaultTimeoutMs: 12000
|
||||
defaultTimeoutMs: 12000,
|
||||
// 浏览器默认超时,浏览器可能需要更高的超时时间
|
||||
chromeTimeoutMS: 120000
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ export class ChatGPTPuppeteer extends Puppeteer {
|
|||
await maximizePage(this._page)
|
||||
await this._page.reload({
|
||||
waitUntil: 'networkidle2',
|
||||
timeout: 2 * 60 * 1000 // 2 minutes
|
||||
timeout: Config.chromeTimeoutMS // 2 minutes
|
||||
})
|
||||
if (this._minimize) {
|
||||
await minimizePage(this._page)
|
||||
|
|
@ -465,7 +465,7 @@ export class ChatGPTPuppeteer extends Puppeteer {
|
|||
)
|
||||
throw err
|
||||
}
|
||||
let timeout = 10000
|
||||
let timeout = 100000
|
||||
if (isAuthenticated) {
|
||||
while (!this._accessToken) {
|
||||
// wait for async response hook result
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export async function getOpenAIAuth (opt) {
|
|||
password,
|
||||
browser,
|
||||
page,
|
||||
timeoutMs = 2 * 60 * 1000,
|
||||
timeoutMs = Config.chromeTimeoutMS,
|
||||
isGoogleLogin = false,
|
||||
captchaToken = Config['2captchaToken'],
|
||||
executablePath = Config.chromePath
|
||||
|
|
@ -48,7 +48,7 @@ export async function getOpenAIAuth (opt) {
|
|||
while (retry > 0) {
|
||||
try {
|
||||
await waitForConditionOrAtCapacity(page, () =>
|
||||
page.waitForSelector('#__next .btn-primary', { timeout: 2000 })
|
||||
page.waitForSelector('#__next .btn-primary', { timeout: timeoutMs / 3 })
|
||||
)
|
||||
} catch (e) {
|
||||
await checkForChatGPTAtCapacity(page)
|
||||
|
|
@ -56,7 +56,7 @@ export async function getOpenAIAuth (opt) {
|
|||
retry--
|
||||
}
|
||||
await waitForConditionOrAtCapacity(page, () =>
|
||||
page.waitForSelector('#__next .btn-primary', { timeout: 2000 })
|
||||
page.waitForSelector('#__next .btn-primary', { timeout: timeoutMs / 3 })
|
||||
)
|
||||
await delay(500)
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ export async function getOpenAIAuth (opt) {
|
|||
|
||||
async function checkForChatGPTAtCapacity (page, opts = {}) {
|
||||
const {
|
||||
timeoutMs = 2 * 60 * 1000, // 2 minutes
|
||||
timeoutMs = Config.chromeTimeoutMS, // 2 minutes
|
||||
pollingIntervalMs = 3000,
|
||||
retries = 10
|
||||
} = opts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue