Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
0pg committed Jan 4, 2023
1 parent 8bb6148 commit 485d388
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions redis/src/main/scala/zio/redis/ClusterExecutor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ final case class ClusterExecutor(
} yield result
}

def executePubSub(command: Chunk[RespValue.BulkString]): Stream[RedisError, RespValue] =
ZStream.fromZIO {
for {
keySlot <- extractKeySlot(command)
executor <- executor(keySlot)
stream = executor.executePubSub(command)
} yield stream
}.flatten

private def extractKeySlot(command: Chunk[RespValue.BulkString]) =
for {
key <- ZIO.attempt(command(1)).orElseFail(CusterKeyError)
Expand Down Expand Up @@ -98,15 +107,6 @@ final case class ClusterExecutor(
case _: RedisError.IOError | _: RedisError.ClusterRedisError => true
case _ => false
}

def executePubSub(command: Chunk[RespValue.BulkString]): Stream[RedisError, RespValue] =
ZStream.fromZIO {
for {
keySlot <- extractKeySlot(command)
executor <- executor(keySlot)
stream = executor.executePubSub(command)
} yield stream
}.flatten
}

object ClusterExecutor {
Expand Down

0 comments on commit 485d388

Please sign in to comment.