Use an epoch number for the clients online to fix query

This commit is contained in:
Owen
2025-08-13 20:26:50 -07:00
parent dc50190dc3
commit 285e24cdc7
3 changed files with 4 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ export const startOfflineChecker = (): void => {
.set({ online: false })
.where(
eq(clients.online, true) &&
(lt(clients.lastPing, twoMinutesAgo.toISOString()) || isNull(clients.lastPing))
(lt(clients.lastPing, twoMinutesAgo.getTime() / 1000) || isNull(clients.lastPing))
);
} catch (error) {
@@ -72,7 +72,7 @@ export const handleOlmPingMessage: MessageHandler = async (context) => {
await db
.update(clients)
.set({
lastPing: new Date().toISOString(),
lastPing: new Date().getTime() / 1000,
online: true,
})
.where(eq(clients.clientId, olm.clientId));