From 1a4916ffeeca6f7836aee72fdf9e15014f5c561b Mon Sep 17 00:00:00 2001 From: Christoph Bunte Date: Wed, 22 Nov 2023 14:51:52 +0100 Subject: [PATCH] fix match error in `RedisPubSub.fromConnection` by unwrapping `TimeoutConnection` --- .../scala/io/chrisdavenport/rediculous/RedisConnection.scala | 4 ++-- .../main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala index 0de57eb..71a6e8a 100644 --- a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala +++ b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala @@ -671,10 +671,10 @@ object RedisConnection{ private def raceNThrowFirst[F[_]: Concurrent, A](nel: NonEmptyList[F[A]]): F[A] = Stream(Stream.emits(nel.toList).evalMap(identity)).covary[F].parJoinUnbounded.take(1).compile.lastOrError - private class TimeoutConnection[F[_]: Temporal](rC: RedisConnection[F], duration: Duration) extends RedisConnection[F] { + private[rediculous] case class TimeoutConnection[F[_]: Temporal](rC: RedisConnection[F], duration: Duration) extends RedisConnection[F] { def runRequest(inputs: Chunk[NonEmptyList[ByteVector]], key: Option[ByteVector]): F[Chunk[Resp]] = rC.runRequest(inputs, key).timeout(duration) } -} \ No newline at end of file +} diff --git a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala index e99a1cd..fcb8f13 100644 --- a/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala +++ b/core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisPubSub.scala @@ -220,6 +220,7 @@ object RedisPubSub { * connections to all nodes. **/ def fromConnection[F[_]: Concurrent](connection: RedisConnection[F], maxBytes: Int = 8096, clusterBroadcast: Boolean = false): Resource[F, RedisPubSub[F]] = connection match { + case RedisConnection.TimeoutConnection(conn, _) => fromConnection(conn, maxBytes, clusterBroadcast) case RedisConnection.Queued(_, sockets) => sockets.flatMap{managed => val messagesR = Concurrent[F].ref(Map[String, RedisPubSub.PubSubMessage => F[Unit]]()) @@ -284,4 +285,4 @@ object RedisPubSub { Array(Some(List(BulkString(Some(message)), BulkString(Some(foo)), BulkString(Some(hi there!))))) Array(Some(List(BulkString(Some(punsubscribe)), BulkString(Some(foos)), Integer(1)))) */ -} \ No newline at end of file +}