1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

ring: reduce HeartbeatFrequency.

This commit is contained in:
Vladimir Mihailenco
2016-08-09 13:32:08 +00:00
parent 1324657ba9
commit 66f2eb1584
3 changed files with 33 additions and 27 deletions

View File

@ -12,6 +12,7 @@ import (
)
var _ = Describe("Redis ring", func() {
const heartbeat = 100 * time.Millisecond
var ring *redis.Ring
setRingKeys := func() {
@ -27,6 +28,7 @@ var _ = Describe("Redis ring", func() {
"ringShardOne": ":" + ringShard1Port,
"ringShardTwo": ":" + ringShard2Port,
},
HeartbeatFrequency: heartbeat,
})
// Shards should not have any keys.
@ -53,10 +55,9 @@ var _ = Describe("Redis ring", func() {
// Stop ringShard2.
Expect(ringShard2.Close()).NotTo(HaveOccurred())
// Ring needs 5 * heartbeat time to detect that node is down.
// Ring needs 3 * heartbeat time to detect that node is down.
// Give it more to be sure.
heartbeat := 100 * time.Millisecond
time.Sleep(2 * 5 * heartbeat)
time.Sleep(2 * 3 * heartbeat)
setRingKeys()