Stabilize QUIC pressure snapshots

This commit is contained in:
2026-05-16 12:55:48 +03:00
parent c64531d70c
commit 83a1bb67e2
2 changed files with 12 additions and 0 deletions
@@ -7,6 +7,7 @@ import (
"crypto/x509"
"encoding/hex"
"fmt"
"sort"
"strings"
"sync"
"time"
@@ -412,6 +413,15 @@ func (t *QUICFabricTransport) Snapshot() QUICFabricTransportSnapshot {
snapshot.CapacityPressurePercent = (snapshot.ActiveStreams * 100) / capacity
}
}
sort.Slice(snapshot.Connections, func(i, j int) bool {
if snapshot.Connections[i].PeerID != snapshot.Connections[j].PeerID {
return snapshot.Connections[i].PeerID < snapshot.Connections[j].PeerID
}
if snapshot.Connections[i].Endpoint != snapshot.Connections[j].Endpoint {
return snapshot.Connections[i].Endpoint < snapshot.Connections[j].Endpoint
}
return snapshot.Connections[i].CertSHA256 < snapshot.Connections[j].CertSHA256
})
return snapshot
}