From 6682d5c59a99f1c34d4905e859a9a77fa7c25f77 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Wed, 29 Jan 2025 12:39:10 -0700 Subject: [PATCH] Update "last updated" time when fetching from primary node Fetches from the primary farside node were not updating the "last updated" time, and would only show a placeholder UTC timestamp. --- db/cron.go | 1 + server/server.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/db/cron.go b/db/cron.go index a7282a4..7b7e9ce 100644 --- a/db/cron.go +++ b/db/cron.go @@ -53,6 +53,7 @@ func queryServiceInstances() { SetInstances(service.Type, service.Instances) } + LastUpdate = time.Now().UTC() return } diff --git a/server/server.go b/server/server.go index 74bfa6c..a002662 100644 --- a/server/server.go +++ b/server/server.go @@ -79,6 +79,10 @@ func routing(w http.ResponseWriter, r *http.Request, jsEnabled bool) { path := strings.TrimPrefix(url.Path, "/") segments := strings.Split(path, "/") + if len(segments[0]) == 0 { + http.Redirect(w, r, "", http.StatusTemporaryRedirect) + } + target, err := services.MatchRequest(segments[0]) if err != nil { log.Printf("Error during match request: %v\n", err)