diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 6eb9482d..cad30fde 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1562,49 +1562,11 @@ export const syncWorldState = async (): Promise => { logger.warn(`Unknown action ${action} for field ${name} in world state sync`); continue; } - let nextSync = Number.MAX_SAFE_INTEGER; if (interval && interval > 0) { - nextSync = Date.now() + interval * 1000; // Convert seconds to milliseconds - } - for (const key in fields) { - switch (key) { - case "VoidTraders": - case "Invasions": - case "SyndicateMissions": - case "ActiveMissions": - case "NodeOverrides": - case "PrimeVaultTraders": - case "DailyDeals": { - if (Array.isArray(staticWorldState_[key])) { - const items = staticWorldState_[key] as ( - | { Expiry?: { $date?: { $numberLong?: string } } } - | undefined - )[]; - for (const item of items) { - const expire = item?.Expiry?.$date?.$numberLong; - if (typeof expire !== "string") continue; - const expireMs = parseInt(expire, 10); - if (isNaN(expireMs)) continue; - nextSync = Math.min(nextSync, expireMs); - } - } - } - } - } - logger.info(`World state sync completed, next sync at ${nextSync}`); - if (nextSync < Number.MAX_SAFE_INTEGER) { - let nextSyncDelta = nextSync - Date.now(); - if (nextSyncDelta < 60 * 1000) { - // Don't schedule syncs more often than once per minute - logger.warn("Next world state sync is scheduled too soon, delaying it by 1 minute"); - nextSyncDelta = 60 * 1000; - } else { - nextSyncDelta += 1000; - } - logger.info(`Next world state sync in ${Math.round(nextSyncDelta / 1000)} seconds`); + logger.info(`Next world state sync in ${interval} seconds`); syncWorldStateTimer = setTimeout(() => { void syncWorldState(); - }, nextSyncDelta); + }, interval * 1000); } else { logger.info("No next world state sync scheduled"); }