From 34429428931440366cffd0a3b4f61b2aca66f2de Mon Sep 17 00:00:00 2001 From: hareland Date: Fri, 28 Mar 2025 12:06:17 +0100 Subject: [PATCH 1/2] fix(bandwidth): Record correct megaBytesIn/megaBytesOut --- server/routers/gerbil/receiveBandwidth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/routers/gerbil/receiveBandwidth.ts b/server/routers/gerbil/receiveBandwidth.ts index b2063c08..fce0531f 100644 --- a/server/routers/gerbil/receiveBandwidth.ts +++ b/server/routers/gerbil/receiveBandwidth.ts @@ -59,8 +59,8 @@ export const receiveBandwidth = async ( await trx .update(sites) .set({ - megabytesOut: (site.megabytesIn || 0) + bytesIn, - megabytesIn: (site.megabytesOut || 0) + bytesOut, + megabytesIn: (site.megabytesIn || 0) + bytesIn, + megabytesOut: (site.megabytesOut || 0) + bytesOut, lastBandwidthUpdate: new Date().toISOString(), online }) From 131df8aeb739e98753febcdc0dd6a3ff73e94b45 Mon Sep 17 00:00:00 2001 From: hareland Date: Fri, 28 Mar 2025 14:54:37 +0100 Subject: [PATCH 2/2] fix(bandwidth): use correct flipping and addition --- server/routers/gerbil/receiveBandwidth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/routers/gerbil/receiveBandwidth.ts b/server/routers/gerbil/receiveBandwidth.ts index fce0531f..f2569b55 100644 --- a/server/routers/gerbil/receiveBandwidth.ts +++ b/server/routers/gerbil/receiveBandwidth.ts @@ -59,8 +59,8 @@ export const receiveBandwidth = async ( await trx .update(sites) .set({ - megabytesIn: (site.megabytesIn || 0) + bytesIn, - megabytesOut: (site.megabytesOut || 0) + bytesOut, + megabytesOut: (site.megabytesOut || 0) + bytesIn, + megabytesIn: (site.megabytesIn || 0) + bytesOut, lastBandwidthUpdate: new Date().toISOString(), online })