fix: harden session cache + heartbeat restore
Co-authored-by: Ronak Guliani <ronak-guliani@users.noreply.github.com>
This commit is contained in:
@@ -148,8 +148,9 @@ async function restoreHeartbeatUpdatedAt(params: {
|
||||
const store = loadSessionStore(storePath);
|
||||
const entry = store[sessionKey];
|
||||
if (!entry) return;
|
||||
if (entry.updatedAt === updatedAt) return;
|
||||
store[sessionKey] = { ...entry, updatedAt };
|
||||
const nextUpdatedAt = Math.max(entry.updatedAt ?? 0, updatedAt);
|
||||
if (entry.updatedAt === nextUpdatedAt) return;
|
||||
store[sessionKey] = { ...entry, updatedAt: nextUpdatedAt };
|
||||
await saveSessionStore(storePath, store);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user