more logs since k6 is fucked
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 27s
Build and Publish / BuildAndDeploy (push) Successful in 2m23s

This commit is contained in:
matst80
2024-11-13 11:42:51 +01:00
parent 3afffe7815
commit 7cc9b48720
2 changed files with 5 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"log"
"net/http"
"strconv"
@@ -47,6 +48,7 @@ func ErrorHandler(fn func(w http.ResponseWriter, r *http.Request) error) func(w
return func(w http.ResponseWriter, r *http.Request) {
err := fn(w, r)
if err != nil {
log.Printf("Server error, not remote error: %v\n", err)
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error()))
}
@@ -57,6 +59,7 @@ func (s *PoolServer) WriteResult(w http.ResponseWriter, result *CallResult) erro
w.Header().Set("Content-Type", "application/json")
w.Header().Set("X-Pod-Name", s.pod_name)
if result.StatusCode != 200 {
log.Printf("Call error: %d\n", result.StatusCode)
if result.StatusCode >= 200 && result.StatusCode < 600 {
w.WriteHeader(int(result.StatusCode))
} else {

View File

@@ -339,7 +339,7 @@ func (p *SyncedPool) RequestOwnership(id CartId) error {
if !r.IsHealthy() {
continue
}
log.Printf("Asking for confirmation change of %s to %s (me) with %s\n", id, p.Hostname, r.Host)
//log.Printf("Asking for confirmation change of %s to %s (me) with %s\n", id, p.Hostname, r.Host)
err := r.ConfirmChange(id, p.Hostname)
all++
if err != nil {
@@ -352,14 +352,10 @@ func (p *SyncedPool) RequestOwnership(id CartId) error {
}
continue
}
log.Printf("Remote confirmed change %s\n", r.Host)
//log.Printf("Remote confirmed change %s\n", r.Host)
ok++
}
if ok == 0 && all > 0 {
p.removeLocalGrain(id)
return fmt.Errorf("no remotes confirmed change")
}
if (all < 3 && ok < all) || ok < (all/2) {
p.removeLocalGrain(id)
return fmt.Errorf("quorum not reached")