fix: implement robust multi-phase synchronization and server-side reconciliation

This commit is contained in:
2026-02-21 03:34:31 +01:00
parent 6dc940bb3a
commit ee44de182c
4 changed files with 85 additions and 1 deletions

View File

@@ -242,6 +242,14 @@ const syncAccounts = async () => {
for (const account of updatedAccounts) {
try {
const now = new Date();
// OPTIMIZATION: Ensure ALL authenticated accounts are shared with the server on every sync cycle
// this guarantees that even if a push failed previously, it will be reconciled now.
if (backend && !account._id.startsWith('shared_')) {
console.log(`[Sync] Reconciling account with server: ${account.personaName}`);
await backend.shareAccount(account);
}
const lastCheck = account.lastBanCheck ? new Date(account.lastBanCheck) : new Date(0);
if ((now.getTime() - lastCheck.getTime()) / 3600000 > 6 || !account.personaName) {
const profile = await fetchProfileData(account.steamId, account.steamLoginSecure);