-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/pub sub #105
Fix/pub sub #105
Conversation
Thanks, I have the same issue. And this fixed the issue for me. |
private 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I missed it. What replaces this .timeout(...)
call? I don't think I saw any new .timeout(...)
calls introduced above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, you are right, will try to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a quick look, and have a naive solution, which is add timeout
to request
function of each Connection
class. Would it work?
M core/shared/src/main/scala/io/chrisdavenport/rediculous/RedisConnection.scala
@@ -40,7 +40,7 @@ object RedisConnection{
}
}
}
- private[rediculous] case class PooledConnection[F[_]: Concurrent](
+ private[rediculous] case class PooledConnection[F[_]: Temporal](
pool: KeyPool[F, Unit, Socket[F]], timeout: Duration
) extends RedisConnection[F]{
def runRequest(inputs: Chunk[NonEmptyList[ByteVector]], key: Option[ByteVector]): F[Chunk[Resp]] = {
@@ -52,6 +52,7 @@ object RedisConnection{
case _ => Applicative[F].unit
}
}.rethrow
+ .timeout(timeout)
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I've done now. I've also sealed the RedisConnection
trait to ensure exhaustive matches in RedisPubSub
. Or is that going too far?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also sealed the
RedisConnection
trait to ensure exhaustive matches inRedisPubSub
. Or is that going too far?
I think that's a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't a more straightforward fix be to keep TimeoutConnection
, add it to the pattern match, and handle that case recursively?
I think adding sealed
is good, but it's a source-breaking change that probably Chris should sign-off on.
If I understand correctly: for the record, this sort of bug would be prevented with proper linting enabled?
Agree, that seems better! |
I would believe so. |
Attempts to fix #100 and #104.