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:
@ -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()
|
||||
|
||||
|
Reference in New Issue
Block a user