-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
Description
It's nice to use ping command to check if the connection is still alive.
- It almost works currently, except
- RedisConnection.toReceiveChannel is broken.
vertx-redis-client/src/main/java/io/vertx/redis/client/impl/RedisStandaloneConnection.java
Line 378 in e3731a3
if ((reply != null && reply.type() == ResponseType.PUSH) || empty) { |
- run in pubsub mode
- call conn.toReceiveChannel, it will pause the stream first, then call ReadStream.fetch(1)
- run ping command and redis server reply with pong
- the handle in RedisStandaloneConnection didn't dispatch the reply of ping to onMessage
- so nobody will call stream.fetch(1), the stream can't receive any more
private class ChannelReadStream<T>(val stream: ReadStream<T>,
val channel: Channel<T>,
context: Context) : Channel<T> by channel, CoroutineScope {
override val coroutineContext: CoroutineContext = context.dispatcher()
fun subscribe() {
stream.endHandler {
close()
}
stream.exceptionHandler { err ->
close(err)
}
stream.handler { event ->
launch {
send(event)
stream.fetch(1)
}
}
}
}
RobertoUa