mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Updates based on comments.
This commit is contained in:
@@ -503,8 +503,8 @@ func (s *Sublist) Stats() *SublistStats {
|
||||
st := &SublistStats{}
|
||||
st.NumSubs = s.count
|
||||
st.NumCache = uint32(len(s.cache))
|
||||
st.NumInserts = atomic.LoadUint64(&s.inserts)
|
||||
st.NumRemoves = atomic.LoadUint64(&s.removes)
|
||||
st.NumInserts = s.inserts
|
||||
st.NumRemoves = s.removes
|
||||
st.NumMatches = atomic.LoadUint64(&s.matches)
|
||||
if st.NumMatches > 0 {
|
||||
st.CacheHitRate = float64(atomic.LoadUint64(&s.cacheHits)) / float64(st.NumMatches)
|
||||
|
||||
@@ -34,7 +34,7 @@ func runMonitorServer() *server.Server {
|
||||
}
|
||||
|
||||
// Runs a clustered pair of monitor servers for testing the /routez endpoint
|
||||
func runMonitorServerClusteredPair() (*server.Server, *server.Server) {
|
||||
func runMonitorServerClusteredPair(t *testing.T) (*server.Server, *server.Server) {
|
||||
resetPreviousHTTPConnections()
|
||||
opts := DefaultTestOptions
|
||||
opts.Port = CLIENT_PORT
|
||||
@@ -56,6 +56,8 @@ func runMonitorServerClusteredPair() (*server.Server, *server.Server) {
|
||||
|
||||
s2 := RunServer(&opts2)
|
||||
|
||||
checkClusterFormed(t, s1, s2)
|
||||
|
||||
return s1, s2
|
||||
}
|
||||
|
||||
@@ -139,13 +141,10 @@ func testEndpointDataRace(endpoint string, t *testing.T) {
|
||||
|
||||
func TestEndpointDataRaces(t *testing.T) {
|
||||
// setup a small cluster to test /routez
|
||||
s1, s2 := runMonitorServerClusteredPair()
|
||||
s1, s2 := runMonitorServerClusteredPair(t)
|
||||
defer s1.Shutdown()
|
||||
defer s2.Shutdown()
|
||||
|
||||
// give some time for a route to form
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
// test all of our endpoints
|
||||
testEndpointDataRace("varz", t)
|
||||
testEndpointDataRace("connz", t)
|
||||
|
||||
Reference in New Issue
Block a user