mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-14 18:20:42 -07:00
Update start time for readloop started, check RTT on flapper test
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -894,7 +894,10 @@ func (c *client) readLoop() {
|
||||
// Check the per-account-cache for closed subscriptions
|
||||
cpacc := c.kind == ROUTER || c.kind == GATEWAY
|
||||
// Last per-account-cache check for closed subscriptions
|
||||
lpacc := time.Now()
|
||||
now := time.Now()
|
||||
lpacc := now
|
||||
// Update our notion of when we started. Useful for better initial RTT estimation.
|
||||
c.start = now
|
||||
c.mu.Unlock()
|
||||
|
||||
defer func() {
|
||||
|
||||
@@ -705,6 +705,9 @@ func TestServiceLatencyWithQueueSubscribersAndNames(t *testing.T) {
|
||||
nc.Flush()
|
||||
}
|
||||
|
||||
// Wait for them all to propagate.
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
doRequest := func() {
|
||||
nc := clientConnect(t, selectServer(), "bar")
|
||||
defer nc.Close()
|
||||
@@ -731,6 +734,13 @@ func TestServiceLatencyWithQueueSubscribersAndNames(t *testing.T) {
|
||||
json.Unmarshal(msg.Data, &sl)
|
||||
rlock.Lock()
|
||||
results[sl.Responder.Name] += sl.ServiceLatency
|
||||
// This test is measuring for sampling and service latency.
|
||||
// In a loaded test, like on Travis, our RTT estimation for
|
||||
// the responder may be off slightly. So we check and compensate
|
||||
// for that here.
|
||||
if sl.Responder.RTT > 25*time.Millisecond {
|
||||
results[sl.Responder.Name] += sl.Responder.RTT
|
||||
}
|
||||
serviced[sl.Responder.Name]++
|
||||
rlock.Unlock()
|
||||
if r := atomic.AddInt32(&received, 1); r >= toSend {
|
||||
|
||||
Reference in New Issue
Block a user