fix: implement granular session health detection with SteamAuthError and smart conditional replacement logic

This commit is contained in:
2026-02-21 04:54:36 +01:00
parent 559c7bfdef
commit 2ef8dd06e7
2 changed files with 29 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ import axios from 'axios';
import fs from 'fs';
import { pathToFileURL } from 'url';
import { fetchProfileData, scrapeBanStatus } from './services/steam-web';
import { scrapeCooldown } from './services/scraper';
import { scrapeCooldown, SteamAuthError } from './services/scraper';
import { steamClient, LocalSteamAccount } from './services/steam-client';
import { BackendService } from './services/backend';
@@ -247,7 +247,12 @@ const scrapeAccountData = async (account: Account) => {
if (backend) await backend.pushCooldown(account.steamId, undefined, now.toISOString());
}
} catch (e: any) {
if (e.message.includes('cookie') || e.message.includes('Sign In')) account.authError = true;
if (e instanceof SteamAuthError) {
account.authError = true;
} else {
console.error(`[Scraper] Temporary error for ${account.personaName}: ${e.message}`);
}
}
}
}
if (backend && !account._id.startsWith('shared_')) {