mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-11 17:56:15 +00:00
Feature: Improved handling of wait times for page checks and reloads, using a 10s timeout for slower networks
This commit is contained in:
@@ -79,8 +79,9 @@ export default class BrowserFunc {
|
||||
await page.goto(this.bot.config.baseURL)
|
||||
|
||||
// IMPROVED: Smart page readiness check after navigation
|
||||
// FIXED: Use timeoutMs parameter with increased timeout for slower networks
|
||||
const readyResult = await waitForPageReady(page, {
|
||||
networkIdleMs: 1000,
|
||||
timeoutMs: 15000, // FIXED: 15s timeout to handle slower network conditions
|
||||
logFn: (msg) => this.bot.log(this.bot.isMobile, 'GO-HOME', msg, 'log')
|
||||
})
|
||||
|
||||
@@ -199,8 +200,9 @@ export default class BrowserFunc {
|
||||
await page.goto(this.bot.config.baseURL)
|
||||
|
||||
// IMPROVED: Wait for page ready after redirect
|
||||
// FIXED: Use timeoutMs parameter with increased timeout
|
||||
await waitForPageReady(page, {
|
||||
networkIdleMs: 1000,
|
||||
timeoutMs: 15000, // FIXED: 15s timeout to handle slower network conditions
|
||||
logFn: (msg) => this.bot.log(this.bot.isMobile, 'GO-HOME', msg, 'log')
|
||||
})
|
||||
} else {
|
||||
@@ -258,8 +260,9 @@ export default class BrowserFunc {
|
||||
await this.goHome(target)
|
||||
|
||||
// IMPROVED: Smart page readiness check instead of fixed wait
|
||||
// FIXED: Use timeoutMs parameter with increased timeout
|
||||
await waitForPageReady(target, {
|
||||
networkIdleMs: 1000,
|
||||
timeoutMs: 15000, // FIXED: 15s timeout for dashboard recovery
|
||||
logFn: (msg) => this.bot.log(this.bot.isMobile, 'BROWSER-FUNC', msg, 'log')
|
||||
}).catch((error) => {
|
||||
const errorMsg = error instanceof Error ? error.message : String(error)
|
||||
|
||||
@@ -209,6 +209,7 @@ export default class BrowserUtil {
|
||||
this.bot.log(this.bot.isMobile, 'RELOAD-BAD-PAGE', `Bad page detected (${errorType}), reloading!`)
|
||||
await page.reload({ waitUntil: 'domcontentloaded' })
|
||||
// IMPROVED: Use smart wait instead of fixed 1500ms delay
|
||||
// FIXED: Use default 10s timeout for page reload
|
||||
await waitForPageReady(page)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user