mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix(cli): calculate coder ping max correctly (#18734)
Embarassing mistake I made months ago 😦
*Doesn't effect schmoder, since we don't parse that max, it calculates it itself
This commit is contained in:
+1
-1
@@ -53,7 +53,7 @@ func (s *pingSummary) addResult(r *ipnstate.PingResult) {
|
||||
if s.Min == nil || r.LatencySeconds < s.Min.Seconds() {
|
||||
s.Min = ptr.Ref(time.Duration(r.LatencySeconds * float64(time.Second)))
|
||||
}
|
||||
if s.Max == nil || r.LatencySeconds > s.Min.Seconds() {
|
||||
if s.Max == nil || r.LatencySeconds > s.Max.Seconds() {
|
||||
s.Max = ptr.Ref(time.Duration(r.LatencySeconds * float64(time.Second)))
|
||||
}
|
||||
s.latencySum += r.LatencySeconds
|
||||
|
||||
@@ -21,11 +21,11 @@ func TestBuildSummary(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Err: "",
|
||||
LatencySeconds: 0.2,
|
||||
LatencySeconds: 0.3,
|
||||
},
|
||||
{
|
||||
Err: "",
|
||||
LatencySeconds: 0.3,
|
||||
LatencySeconds: 0.2,
|
||||
},
|
||||
{
|
||||
Err: "ping error",
|
||||
|
||||
Reference in New Issue
Block a user