mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
@@ -1463,7 +1463,7 @@ func (c *client) processPing() {
|
||||
c.sendPong()
|
||||
|
||||
// Record this to suppress us sending one if this
|
||||
// is withing a given time interval for activity.
|
||||
// is within a given time interval for activity.
|
||||
c.ping.last = time.Now()
|
||||
|
||||
// If not a CLIENT, we are done
|
||||
@@ -2666,7 +2666,7 @@ func (c *client) processPingTimer() {
|
||||
}
|
||||
|
||||
// Lock should be held
|
||||
// We Randomize the first one by an offset up to 20%, e.g. 2m ~= max 24s.
|
||||
// We randomize the first one by an offset up to 20%, e.g. 2m ~= max 24s.
|
||||
// This is because the clients by default are usually setting same interval
|
||||
// and we have alot of cross ping/pongs between clients and servers.
|
||||
// We will now suppress the server ping/pong if we have received a client ping.
|
||||
|
||||
@@ -223,6 +223,7 @@ func TestPingSuppresion(t *testing.T) {
|
||||
send("PING\r\n")
|
||||
expect(pongRe)
|
||||
|
||||
// This will wait for
|
||||
// This will wait for the time period where a PING should have fired
|
||||
// and been delivered. We expect nothing here since it should be suppressed.
|
||||
expectNothingTimeout(t, c, time.Now().Add(100*time.Millisecond))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user