1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-04-19 18:38:42 +00:00

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.
This commit is contained in:
Ben Busby 2025-01-29 12:39:10 -07:00
parent f140cdfd66
commit 6682d5c59a
No known key found for this signature in database
GPG key ID: B9B7231E01D924A1
2 changed files with 5 additions and 0 deletions

View file

@ -53,6 +53,7 @@ func queryServiceInstances() {
SetInstances(service.Type, service.Instances) SetInstances(service.Type, service.Instances)
} }
LastUpdate = time.Now().UTC()
return return
} }

View file

@ -79,6 +79,10 @@ func routing(w http.ResponseWriter, r *http.Request, jsEnabled bool) {
path := strings.TrimPrefix(url.Path, "/") path := strings.TrimPrefix(url.Path, "/")
segments := strings.Split(path, "/") segments := strings.Split(path, "/")
if len(segments[0]) == 0 {
http.Redirect(w, r, "", http.StatusTemporaryRedirect)
}
target, err := services.MatchRequest(segments[0]) target, err := services.MatchRequest(segments[0])
if err != nil { if err != nil {
log.Printf("Error during match request: %v\n", err) log.Printf("Error during match request: %v\n", err)