From 63208ee20359c6b597f88246ee47420018dbff31 Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 17 Dec 2024 08:23:19 -0600 Subject: [PATCH] adjust latency periods, display form for -1 --- api/latency.go | 4 +++- frontend/src/components/Offer.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/latency.go b/api/latency.go index aa2d0ea..7a8221d 100644 --- a/api/latency.go +++ b/api/latency.go @@ -162,9 +162,11 @@ func (l *LatencyQueue) Start(ctx context.Context) { // Store the result in Redis value := "timeout" - expiration := time.Hour*24 + time.Minute*time.Duration(rand.Intn(60*8)) + expiration := time.Hour*8 + time.Minute*time.Duration(rand.Intn(60*8)) if success { value = results.AvgRtt.String() + } else { + expiration = time.Hour*4 + time.Minute*time.Duration(rand.Intn(60*4)) } l.logger.Debugw("Ping Result", "ip", ip, "latency", value) diff --git a/frontend/src/components/Offer.tsx b/frontend/src/components/Offer.tsx index 18207e1..728f929 100644 --- a/frontend/src/components/Offer.tsx +++ b/frontend/src/components/Offer.tsx @@ -30,7 +30,9 @@ export default function Offer({ {mb_to_gb(offer.gpu_ram)} GB - {latency ?? "?"} + + {latency == -1 ? "??" : latency} + ms