Skip to content
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a280504
Add redis pubsub layer
0pg Dec 28, 2022
cd4a3f3
Fix PubSub api
0pg Feb 7, 2023
a01213d
Apply changes to t/c
0pg Feb 7, 2023
9541519
Set private accessor
0pg Feb 7, 2023
ba89a59
Merge remote-tracking branch 'upstream/master' into impl/pubsub
0pg Feb 7, 2023
9723182
Fix cleanup code
0pg Feb 7, 2023
65b524b
Modify callback and unsubscribe logic in SingleNodeRedisPubSub
0pg Feb 7, 2023
892ba20
Apply changes to t/c
0pg Feb 7, 2023
43edb47
Modify PubSub api
0pg Feb 7, 2023
a6f74fa
Apply changes to t/c
0pg Feb 7, 2023
c7decb7
Fix typo
0pg Feb 7, 2023
b6438f0
Modify accessor
0pg Feb 7, 2023
5fb75e4
Update redis/src/main/scala/zio/redis/Output.scala
0pg Feb 9, 2023
ce97f95
Update redis/src/main/scala/zio/redis/Output.scala
0pg Feb 9, 2023
a25805b
Modify responsibility to transform streams
0pg Feb 9, 2023
fd0b303
Apply changes to t/c
0pg Feb 9, 2023
7cb1491
Move SubscriptionKey into only used place
0pg Feb 10, 2023
2ab2db1
Merge remote-tracking branch 'upstream/master' into impl/pubsub
0pg Feb 10, 2023
87eee71
Fix onSubscribe callback race condition bug
0pg Feb 11, 2023
f532e4b
Add pacakge private accessor to PubSubCommand
0pg Feb 11, 2023
e9e2a3c
Modify unsubscrption release logic
0pg Feb 11, 2023
014d2e4
Merge remote-tracking branch 'upstream/master' into impl/pubsub
0pg Feb 14, 2023
49c141b
Modify RedisPubSubCommand interface
0pg Feb 14, 2023
8b6ce73
Apply changes to test
0pg Feb 14, 2023
f44c7fc
Add pubsub layer in Main
0pg Feb 14, 2023
758ea9b
Remove BinaryCodec layer to RedisPubSub interface
0pg Feb 20, 2023
9febcf8
Modify SingleNodeRedisPubSub failover step
0pg Feb 20, 2023
92aea5e
Merge remote-tracking branch 'upstream/master' into impl/pubsub
0pg Mar 26, 2023
3fc77c0
Separate Publish and Subscribe
0pg Mar 30, 2023
3c8a307
Rename classes
0pg Mar 30, 2023
0ea75a1
Reduce duplication
0pg Mar 31, 2023
ef3b9f1
Merge remote-tracking branch 'upstream/master' into impl/pubsub
0pg Mar 31, 2023
478577b
Apply upstream changes
0pg Mar 31, 2023
c4105ff
Replace Hub to Queue
0pg Apr 4, 2023
f432815
Merge remote-tracking branch 'upstream/master' into impl/pubsub
0pg Apr 25, 2023
149ae4b
Remove unused code
0pg Apr 27, 2023
67652e6
Refine subscription api
0pg Apr 27, 2023
8606409
Rename fields
0pg May 2, 2023
6a3f68f
Update modules/redis/src/main/scala/zio/redis/RedisSubscription.scala
0pg May 2, 2023
1a0862f
Add newline
0pg May 5, 2023
92457c4
Fix broken compile
0pg May 7, 2023
bf52e26
Formatting
0pg May 7, 2023
c027295
Fix lint
0pg May 7, 2023
a154683
Reduce duplications and refactor package layout
0pg May 10, 2023
592d327
Commit suggestion
0pg May 10, 2023
386fefd
Fix broken compile
0pg May 23, 2023
415f75e
Merge remote-tracking branch 'upstream/master' into impl/pubsub
0pg May 23, 2023
1699211
Use hub instead of chunks of queue
0pg May 30, 2023
be11d67
Add release on error
0pg May 30, 2023
552e002
Extraact common logic
0pg May 30, 2023
e218b08
Ensure order of subs/unsubs
0pg May 31, 2023
ac85cb9
Update modules/redis/src/main/scala/zio/redis/internal/SingleNodeSubs…
0pg Jun 7, 2023
dadb5e7
Use ConcurrentMap instead of Map of Ref
0pg Jun 7, 2023
88c3f4e
Add private accessor
0pg Jun 7, 2023
6e50d4d
Fix accessor
0pg Jun 7, 2023
5ca98e7
Add doc
0pg Jun 26, 2023
539ef3f
Add missing params
0pg Jun 26, 2023
63cc263
Fix test codes
0pg Jul 7, 2023
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
45 changes: 45 additions & 0 deletions modules/redis/src/main/scala/zio/redis/Output.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package zio.redis
import zio._
import zio.redis.internal.RespValue
import zio.redis.options.Cluster.{Node, Partition, SlotRange}
import zio.redis.options.PubSub.{NumberOfSubscribers, PushProtocol}
import zio.schema.Schema
import zio.schema.codec.BinaryCodec

Expand Down Expand Up @@ -639,6 +640,50 @@ object Output {
}
}

case object PushProtocolOutput extends Output[PushProtocol] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename accordingly (see the remark about PushProtocol below). Another question is how visible it should be.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PushMessageOutput is only used in internal package so I added private[redis] to this object
a154683

protected def tryDecode(respValue: RespValue): PushProtocol =
respValue match {
case RespValue.NullArray => throw ProtocolError(s"Array must not be empty")
case RespValue.Array(values) =>
val name = MultiStringOutput.unsafeDecode(values(0))
val key = MultiStringOutput.unsafeDecode(values(1))
name match {
case "subscribe" =>
val num = LongOutput.unsafeDecode(values(2))
PushProtocol.Subscribe(key, num)
case "psubscribe" =>
val num = LongOutput.unsafeDecode(values(2))
PushProtocol.PSubscribe(key, num)
case "unsubscribe" =>
val num = LongOutput.unsafeDecode(values(2))
PushProtocol.Unsubscribe(key, num)
case "punsubscribe" =>
val num = LongOutput.unsafeDecode(values(2))
PushProtocol.PUnsubscribe(key, num)
case "message" =>
PushProtocol.Message(key, values(2))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assign values(2) to a val.

case "pmessage" =>
val channel = MultiStringOutput.unsafeDecode(values(2))
PushProtocol.PMessage(key, channel, values(3))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assign values(3) to a val.

case other => throw ProtocolError(s"$other isn't a pushed message")
}
case other => throw ProtocolError(s"$other isn't an array")
}
}

case object NumSubResponseOutput extends Output[Chunk[NumberOfSubscribers]] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that there is an order in the response, but maybe you should use a Map instead (for easier access to the value of the specific channel).

protected def tryDecode(respValue: RespValue): Chunk[NumberOfSubscribers] =
respValue match {
case RespValue.Array(values) =>
Chunk.fromIterator(values.grouped(2).map { chunk =>
val channel = MultiStringOutput.unsafeDecode(chunk(0))
val numOfSubs = LongOutput.unsafeDecode(chunk(1))
NumberOfSubscribers(channel, numOfSubs)
})
case other => throw ProtocolError(s"$other isn't an array")
}
}

private def decodeDouble(bytes: Chunk[Byte]): Double = {
val text = new String(bytes.toArray, StandardCharsets.UTF_8)
try text.toDouble
Expand Down
1 change: 1 addition & 0 deletions modules/redis/src/main/scala/zio/redis/Redis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ trait Redis
with api.Streams
with api.Scripting
with api.Cluster
with api.Publishing

object Redis {
lazy val cluster: ZLayer[CodecSupplier & RedisClusterConfig, RedisError, Redis] =
Expand Down
5 changes: 4 additions & 1 deletion modules/redis/src/main/scala/zio/redis/RedisError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ object RedisError {
object Moved {
def apply(slotAndAddress: (Slot, RedisUri)): Moved = Moved(slotAndAddress._1, slotAndAddress._2)
}
final case class IOError(exception: IOException) extends RedisError
final case class IOError(exception: IOException) extends RedisError
final case class CommandNameNotFound(message: String) extends RedisError
sealed trait PubSubError extends RedisError
final case class InvalidPubSubCommand(command: String) extends PubSubError
}
34 changes: 34 additions & 0 deletions modules/redis/src/main/scala/zio/redis/RedisSubscription.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2021 John A. De Goes and the ZIO contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package zio.redis

import zio._

trait RedisSubscription extends api.Subscription
Comment thread
mijicd marked this conversation as resolved.

object RedisSubscription {
lazy val local: ZLayer[CodecSupplier, RedisError.IOError, RedisSubscription] =
SubscriptionExecutor.local >>> makeLayer

lazy val singleNode: ZLayer[CodecSupplier & RedisConfig, RedisError.IOError, RedisSubscription] =
SubscriptionExecutor.layer >>> makeLayer

private def makeLayer: URLayer[CodecSupplier & SubscriptionExecutor, RedisSubscription] =
ZLayer.fromFunction(Live.apply _)

private final case class Live(codecSupplier: CodecSupplier, executor: SubscriptionExecutor) extends RedisSubscription
}
5 changes: 5 additions & 0 deletions modules/redis/src/main/scala/zio/redis/ResultBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package zio.redis
import zio.IO
import zio.redis.ResultBuilder.NeedsReturnType
import zio.schema.Schema
import zio.stream.Stream

sealed trait ResultBuilder {
final def map(f: Nothing => Any)(implicit nrt: NeedsReturnType): IO[Nothing, Nothing] = ???
Expand All @@ -45,4 +46,8 @@ object ResultBuilder {
trait ResultOutputBuilder extends ResultBuilder {
def returning[R: Output]: IO[RedisError, R]
}

trait ResultStreamBuilder1[+F[_]] extends ResultBuilder {
def returning[R: Schema]: Stream[RedisError, F[R]]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
/*
* Copyright 2021 John A. De Goes and the ZIO contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package zio.redis
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It belongs to zio.redis.internal.


import zio.redis.Input.{CommandNameInput, StringInput}
import zio.redis.Output.PushProtocolOutput
import zio.redis.SingleNodeSubscriptionExecutor.{Request, RequestQueueSize, True}
import zio.redis.api.Subscription
import zio.redis.internal._
import zio.redis.options.PubSub.PushProtocol
import zio.stream._
import zio.{Chunk, ChunkBuilder, IO, Promise, Queue, Ref, Schedule, Scope, URIO, ZIO}

private[redis] final class SingleNodeSubscriptionExecutor private (
channelSubsRef: Ref[Map[String, Chunk[Queue[Take[RedisError, PushProtocol]]]]],
patternSubsRef: Ref[Map[String, Chunk[Queue[Take[RedisError, PushProtocol]]]]],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use hubs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to ensure the callback is invoked. response messages can be delivered from Redis before target streams are consumed. if we use hub then response messages can be loss that have to invoke callbacks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but maybe It seems like we could use a promise queue for handling response messages (like SingleNodeExecutor) to enable using the hub 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added promise queue for waiting subscribe responses and let them use Hub intead of chunks of Queue

reqQueue: Queue[Request],
connection: RedisConnection
) extends SubscriptionExecutor {
def execute(command: RespCommand): Stream[RedisError, PushProtocol] =
ZStream
.fromZIO(
for {
commandName <-
ZIO
.fromOption(command.args.collectFirst { case RespCommandArgument.CommandName(name) => name })
.orElseFail(RedisError.CommandNameNotFound(command.args.toString()))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's adjust the error constructor to avoid invoking toString explicitly.

stream <- commandName match {
case Subscription.Subscribe => ZIO.succeed(subscribe(channelSubsRef, command))
case Subscription.PSubscribe => ZIO.succeed(subscribe(patternSubsRef, command))
case Subscription.Unsubscribe => ZIO.succeed(unsubscribe(command))
case Subscription.PUnsubscribe => ZIO.succeed(unsubscribe(command))
case other => ZIO.fail(RedisError.InvalidPubSubCommand(other))
}
} yield stream
)
.flatten

private def subscribe(
subscriptionRef: Ref[Map[String, Chunk[Queue[Take[RedisError, PushProtocol]]]]],
command: RespCommand
): Stream[RedisError, PushProtocol] =
ZStream
.fromZIO(
for {
queues <-
ZIO.foreach(command.args.collect { case key: RespCommandArgument.Key => key.value.asString })(key =>
Queue
.unbounded[Take[RedisError, PushProtocol]]
.tap(queue =>
subscriptionRef.update(subscription =>
subscription.updated(key, subscription.getOrElse(key, Chunk.empty) ++ Chunk.single(queue))
)
)
.map(key -> _)
)
promise <- Promise.make[RedisError, Unit]
_ <- reqQueue.offer(
Request(
command.args.map(_.value),
promise
)
)
streams = queues.map { case (key, queue) =>
ZStream
.fromQueueWithShutdown(queue)
.ensuring(
subscriptionRef.update(subscription =>
subscription.get(key) match {
case Some(queues) => subscription.updated(key, queues.filterNot(_ == queue))
case None => subscription
}
)
)
}
_ <- promise.await.tapError(_ => ZIO.foreachDiscard(queues) { case (_, queue) => queue.shutdown })
} yield streams.fold(ZStream.empty)(_ merge _)
)
.flatten
.flattenTake

private def unsubscribe(command: RespCommand): Stream[RedisError, PushProtocol] =
ZStream
.fromZIO(
for {
promise <- Promise.make[RedisError, Unit]
_ <- reqQueue.offer(Request(command.args.map(_.value), promise))
_ <- promise.await
} yield ZStream.empty
)
.flatten

private def send =
reqQueue.takeBetween(1, RequestQueueSize).flatMap { reqs =>
val buffer = ChunkBuilder.make[Byte]()
val it = reqs.iterator

while (it.hasNext) {
val req = it.next()
buffer ++= RespValue.Array(req.command).asBytes
}

val bytes = buffer.result()

connection
.write(bytes)
.mapError(RedisError.IOError(_))
.tapBoth(
e => ZIO.foreachDiscard(reqs.map(_.promise))(_.fail(e)),
_ => ZIO.foreachDiscard(reqs.map(_.promise))(_.succeed(()))
)
}

private def receive: IO[RedisError, Unit] = {
def offerMessage(
subscriptionRef: Ref[Map[String, Chunk[Queue[Take[RedisError, PushProtocol]]]]],
key: String,
msg: PushProtocol
) = for {
subscription <- subscriptionRef.get
_ <- ZIO.foreachDiscard(subscription.get(key))(
ZIO.foreachDiscard(_)(queue => queue.offer(Take.single(msg)).unlessZIO(queue.isShutdown))
)
} yield ()

def releaseStream(subscriptionRef: Ref[Map[String, Chunk[Queue[Take[RedisError, PushProtocol]]]]], key: String) =
for {
subscription <- subscriptionRef.getAndUpdate(_ - key)
_ <- ZIO.foreachDiscard(subscription.get(key))(
ZIO.foreachDiscard(_)(queue => queue.offer(Take.end).unlessZIO(queue.isShutdown))
)
} yield ()

connection.read
.mapError(RedisError.IOError(_))
.via(RespValue.Decoder)
.collectSome
.mapZIO(resp => ZIO.attempt(PushProtocolOutput.unsafeDecode(resp)))
.refineToOrDie[RedisError]
.foreach {
case msg @ PushProtocol.Subscribe(channel, _) => offerMessage(channelSubsRef, channel, msg)
case msg @ PushProtocol.Unsubscribe(channel, _) =>
offerMessage(channelSubsRef, channel, msg) *> releaseStream(channelSubsRef, channel)
case msg @ PushProtocol.Message(channel, _) => offerMessage(channelSubsRef, channel, msg)
case msg @ PushProtocol.PSubscribe(pattern, _) => offerMessage(patternSubsRef, pattern, msg)
case msg @ PushProtocol.PUnsubscribe(pattern, _) =>
offerMessage(patternSubsRef, pattern, msg) *> releaseStream(patternSubsRef, pattern)
case msg @ PushProtocol.PMessage(pattern, _, _) => offerMessage(patternSubsRef, pattern, msg)
}
}

private def resubscribe: IO[RedisError, Unit] = {
def makeCommand(name: String, keys: Chunk[String]) =
if (keys.isEmpty)
Chunk.empty
else
RespValue
.Array((CommandNameInput.encode(name) ++ Input.Varargs(StringInput).encode(keys)).args.map(_.value))
.asBytes

for {
channels <- channelSubsRef.get.map(_.keys)
patterns <- patternSubsRef.get.map(_.keys)
commands = makeCommand(Subscription.Subscribe, Chunk.fromIterable(channels)) ++
makeCommand(Subscription.PSubscribe, Chunk.fromIterable(patterns))
_ <- connection
.write(commands)
.when(commands.nonEmpty)
.mapError(RedisError.IOError(_))
.retryWhile(True)
} yield ()
}

/**
* Opens a connection to the server and launches receive operations. All failures are retried by opening a new
* connection. Only exits by interruption or defect.
*/
val run: IO[RedisError, AnyVal] =
ZIO.logTrace(s"$this PubSub sender and reader has been started") *>
(send.repeat(Schedule.forever) race receive)
.tapError(e => ZIO.logWarning(s"Reconnecting due to error: $e") *> resubscribe)
.retryWhile(True)
.tapError(e => ZIO.logError(s"Executor exiting: $e"))
}

private[redis] object SingleNodeSubscriptionExecutor {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole module if full of copy-paste. Let's try to reduce that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made SingleNodeRunner trait that has two abstract functions send, receive to extract run function

private final case class Request(
command: Chunk[RespValue.BulkString],
promise: Promise[RedisError, Unit]
)

private final val True: Any => Boolean = _ => true

private final val RequestQueueSize = 16

def create(conn: RedisConnection): URIO[Scope, SubscriptionExecutor] =
for {
reqQueue <- Queue.bounded[Request](RequestQueueSize)
channelRef <- Ref.make(Map.empty[String, Chunk[Queue[Take[RedisError, PushProtocol]]]])
patternRef <- Ref.make(Map.empty[String, Chunk[Queue[Take[RedisError, PushProtocol]]]])
pubSub = new SingleNodeSubscriptionExecutor(channelRef, patternRef, reqQueue, conn)
_ <- pubSub.run.forkScoped
_ <- logScopeFinalizer(s"$pubSub Subscription Node is closed")
} yield pubSub
}
42 changes: 42 additions & 0 deletions modules/redis/src/main/scala/zio/redis/SubscriptionExecutor.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2021 John A. De Goes and the ZIO contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package zio.redis

import zio.redis.internal.{RedisConnection, RespCommand}
import zio.redis.options.PubSub.PushProtocol
import zio.stream._
import zio.{Layer, ZIO, ZLayer}

trait SubscriptionExecutor {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't belong here. Similarly to all other executors, it should go to zio.redis.internal.

private[redis] def execute(command: RespCommand): Stream[RedisError, PushProtocol]
}

object SubscriptionExecutor {
lazy val layer: ZLayer[RedisConfig, RedisError.IOError, SubscriptionExecutor] =
RedisConnection.layer.fresh >>> pubSublayer
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need fresh?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, when a client subscribes to channels, it is restricted from sending most commands except for a few that are allowed in a subscribing connection

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it's for separating connection between RedisExecutor and SubscriptionExecutor


lazy val local: Layer[RedisError.IOError, SubscriptionExecutor] =
RedisConnection.local.fresh >>> pubSublayer
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


private lazy val pubSublayer: ZLayer[RedisConnection, RedisError.IOError, SubscriptionExecutor] =
ZLayer.scoped(
for {
conn <- ZIO.service[RedisConnection]
pubSub <- SingleNodeSubscriptionExecutor.create(conn)
} yield pubSub
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ZLayer.scoped(
for {
conn <- ZIO.service[RedisConnection]
pubSub <- SingleNodeSubscriptionExecutor.create(conn)
} yield pubSub
)
ZLayer.scoped {
for {
conn <- ZIO.service[RedisConnection]
pubSub <- SingleNodeSubscriptionExecutor.create(conn)
} yield pubSub
}

}
Loading