Fix 'unsupported value: +Inf' error when the zone doesn't have active servers
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -141,9 +141,15 @@ func (srv *Server) dnsAnswers(c echo.Context) error {
|
||||
totalName = "uk"
|
||||
}
|
||||
if zt, ok := zoneTotals[totalName]; ok {
|
||||
// log.InfoContext(ctx, "netspeed data", "pointBasis", pointBasis, "zt", zt, "server netspeed", serverNetspeed)
|
||||
if zt == 0 {
|
||||
// if the recorded netspeed for the zone was zero, assume it's at least
|
||||
// this servers worth instead. Otherwise the Netspeed gets to be 'infinite'.
|
||||
zt = int32(serverNetspeed)
|
||||
}
|
||||
cc.Netspeed = (pointBasis / float64(zt)) * float64(serverNetspeed)
|
||||
}
|
||||
// log.Info("points", "cc", cc.CC, "points", cc.Points)
|
||||
// log.DebugContext(ctx, "points", "cc", cc.CC, "points", cc.Points)
|
||||
}
|
||||
|
||||
r := struct {
|
||||
|
||||
@@ -113,8 +113,7 @@ func (srv *Server) Run() error {
|
||||
e.Use(otelecho.Middleware("data-api"))
|
||||
e.Use(slogecho.NewWithConfig(log,
|
||||
slogecho.Config{
|
||||
WithTraceID: true,
|
||||
// WithSpanID: true,
|
||||
WithTraceID: false, // done by logger already
|
||||
// WithRequestHeader: true,
|
||||
},
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user