Add receive bandwidth

This commit is contained in:
Owen 2025-02-21 12:41:02 -05:00
parent ef69bf9256
commit a57d32d05d
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
4 changed files with 77 additions and 6 deletions

View file

@ -30,12 +30,13 @@ export const receiveBandwidth = async (
const { publicKey, bytesIn, bytesOut } = peer;
// Find the site by public key
const site = await trx.query.sites.findFirst({
where: eq(sites.pubKey, publicKey)
});
const [site] = await trx
.select()
.from(sites)
.where(eq(sites.pubKey, publicKey))
.limit(1);
if (!site) {
logger.warn(`Site not found for public key: ${publicKey}`);
continue;
}
let online = site.online;