Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/main/scala/com/redis/RedisConnection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ private [redis] class RedisConnection(remote: InetSocketAddress, settings: Redis
context watch pipe

case CommandFailed(c: Connect) =>
log.error("Connect failed for {} with {}. Stopping... ", c.remoteAddress, c.failureMessage)
context stop self
if (reconnectionSchedule.attempts < reconnectionSchedule.maxAttempts) {
val delayMs = reconnectionSchedule.nextDelayMs
log.error("Connect failed for {} with {}. Reconnecting in {} ms... ", c.remoteAddress, c.failureMessage, delayMs)
context become unconnected
context.system.scheduler.scheduleOnce(Duration(delayMs, TimeUnit.MILLISECONDS), IO(Tcp), Connect(remote))(context.dispatcher, self)
} else {
log.error("Connect failed for {} with {}. Stopping... ", c.remoteAddress, c.failureMessage)
context stop self
}
}

def transactional(pipe: ActorRef): Receive = withTerminationManagement {
Expand Down