Skip to content

Commit

Permalink
fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
thirstycrow committed Apr 25, 2017
1 parent 4309ccd commit dd6bc0c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/scala/redis/RedisCluster.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ case class RedisCluster(redisServers: Seq[RedisServer],

val log = Logging.getLogger(_system, this)

val clusterSlotsRef:Ref[Option[Map[ClusterSlot, RedisConnection]]] = Ref(Option.empty[Map[ClusterSlot, RedisConnection]])

val lockClusterSlots = Ref(true)

override val redisServerConnections = collection.mutable.Map {
redisServers.map(makeConnection): _*
}
refreshConnections()

Await.result(asyncRefreshClusterSlots(force=true), 10.seconds)

def makeConnection(server: RedisServer) = {
makeRedisConnection(
server = server.copy(password = password, db = None),
Expand Down Expand Up @@ -58,10 +64,6 @@ case class RedisCluster(redisServers: Seq[RedisServer],
}
}

val clusterSlotsRef:Ref[Option[Map[ClusterSlot, RedisConnection]]] = Ref(Option.empty[Map[ClusterSlot, RedisConnection]])
val lockClusterSlots = Ref(true)
Await.result(asyncRefreshClusterSlots(force=true), 10.seconds)

def getClusterSlots(): Future[Map[ClusterSlot, RedisConnection]] = {

def resolveClusterSlots(retry:Int): Future[Map[ClusterSlot, RedisConnection]] = {
Expand Down

0 comments on commit dd6bc0c

Please sign in to comment.