Skip to content

we may don't need to make sure redis connection is alive in our code  #90

Description

@MayyS

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions