I have a question about this code snippet. Do we need to implement our own connection keep-alive mechanism in the code?
|
again: |
|
for { |
|
select { |
|
case <-ctx.Done(): |
|
return |
|
case <-tick.C: |
|
if !shouldConnect() { |
|
continue |
|
} |
|
for _, v := range c { |
|
if !connectSingleton(v.IsCache, config) { |
|
redisUp.Store(false) |
|
|
|
goto again |
|
} |
|
|
|
if !clusterConnectionIsOpen(v) { |
|
redisUp.Store(false) |
|
|
|
goto again |
|
} |
|
} |
|
redisUp.Store(true) |
|
} |
|
} |
|
} |
I noticed a code snippet in the go-redis library that seems to handle connection keep-alive for us.
https://github.com/redis/go-redis/blob/2eb36ad9c874df5d87c320a816a3687286d10786/internal/pool/pool.go#L87-L106
So, I think that we don't need to implement connection keep-alive in our code again. Is my understanding correct?
I have a question about this code snippet. Do we need to implement our own connection keep-alive mechanism in the code?
iam/pkg/storage/redis_cluster.go
Lines 159 to 184 in 819ffde
I noticed a code snippet in the go-redis library that seems to handle connection keep-alive for us.
https://github.com/redis/go-redis/blob/2eb36ad9c874df5d87c320a816a3687286d10786/internal/pool/pool.go#L87-L106
So, I think that we don't need to implement connection keep-alive in our code again. Is my understanding correct?