fix: implement robust multi-phase synchronization and server-side reconciliation
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user