From ea41fcc5662324ef4ada3f83f702738e2bc02527 Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 16 Mar 2026 17:12:37 -0700 Subject: [PATCH] Also update lastPing for legacy --- server/routers/gerbil/receiveBandwidth.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/routers/gerbil/receiveBandwidth.ts b/server/routers/gerbil/receiveBandwidth.ts index 098a1b558..e06a6d5d0 100644 --- a/server/routers/gerbil/receiveBandwidth.ts +++ b/server/routers/gerbil/receiveBandwidth.ts @@ -97,6 +97,7 @@ export async function flushSiteBandwidthToDb(): Promise { accumulator = new Map(); const currentTime = new Date().toISOString(); + const currentTimeEpochSeconds = Math.floor(new Date().getTime() / 1000); // Sort by publicKey for consistent lock ordering across concurrent // writers — deadlock-prevention strategy. @@ -119,7 +120,8 @@ export async function flushSiteBandwidthToDb(): Promise { .set({ megabytesOut: sql`COALESCE(${sites.megabytesOut}, 0) + ${bytesIn}`, megabytesIn: sql`COALESCE(${sites.megabytesIn}, 0) + ${bytesOut}`, - lastBandwidthUpdate: currentTime + lastBandwidthUpdate: currentTime, + lastPing: currentTimeEpochSeconds }) .where(eq(sites.pubKey, publicKey)) .returning({ @@ -321,4 +323,4 @@ export const receiveBandwidth = async ( ) ); } -}; \ No newline at end of file +};