mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-10 17:26:17 +00:00
fix: Update package version to 2.56.13 and improve timeout handling for custom elements registration
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "microsoft-rewards-bot",
|
"name": "microsoft-rewards-bot",
|
||||||
"version": "2.56.12",
|
"version": "2.56.13",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "microsoft-rewards-bot",
|
"name": "microsoft-rewards-bot",
|
||||||
"version": "2.56.12",
|
"version": "2.56.13",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "CC-BY-NC-SA-4.0",
|
"license": "CC-BY-NC-SA-4.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "microsoft-rewards-bot",
|
"name": "microsoft-rewards-bot",
|
||||||
"version": "2.56.12",
|
"version": "2.56.13",
|
||||||
"description": "Automate Microsoft Rewards points collection",
|
"description": "Automate Microsoft Rewards points collection",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
|||||||
@@ -89,11 +89,17 @@ export default class BrowserFunc {
|
|||||||
this.bot.log(this.bot.isMobile, 'GO-HOME', `Page took ${readyResult.timeMs}ms to be ready (slow)`, 'warn')
|
this.bot.log(this.bot.isMobile, 'GO-HOME', `Page took ${readyResult.timeMs}ms to be ready (slow)`, 'warn')
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMPROVED: Wait for Custom Elements to be registered
|
// IMPROVED: Wait for Custom Elements to be registered with proper timeout handling
|
||||||
|
// FIXED: Use Promise.race to enforce actual 5s timeout (Playwright's timeout doesn't work with customElements.whenDefined)
|
||||||
try {
|
try {
|
||||||
await page.evaluate(() => customElements.whenDefined('mee-card-group'), { timeout: 5000 })
|
await Promise.race([
|
||||||
|
page.evaluate(() => customElements.whenDefined('mee-card-group')),
|
||||||
|
new Promise((_, reject) => setTimeout(() => reject(new Error('Custom element timeout')), 5000))
|
||||||
|
])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.bot.log(this.bot.isMobile, 'GO-HOME', 'mee-card-group custom element not registered within 5s', 'warn')
|
// FIXED: Silent fallback - custom element registration is best-effort, not critical
|
||||||
|
// If it times out, we proceed with activities detection anyway
|
||||||
|
this.bot.log(this.bot.isMobile, 'GO-HOME', 'mee-card-group custom element not registered within 5s (non-critical)', 'log')
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let iteration = 1; iteration <= RETRY_LIMITS.GO_HOME_MAX; iteration++) {
|
for (let iteration = 1; iteration <= RETRY_LIMITS.GO_HOME_MAX; iteration++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user