scala-redis
scala-redis copied to clipboard
PubSub: exception processing is difficult to recover from
When a message of type E is passed back in the callback, it's not clear what the application should do. Ideally, attempting to reconnect at some time interval with or without exponential backoff would be nice to have automatically occur, but doing this at the application level seems wrong somehow. It's also pretty difficult from what I can tell.
What is the right thing to do when a message indicating an exception occurred on the redis client is received?
Currently E is used to handle exceptions that may occur and handle it at https://github.com/debasishg/scala-redis/blob/master/src/main/scala/com/redis/PubSub.scala#L60. The most trivial way to handle it is to initiate a new consumer discarding the current one. You can disconnect using r.disconnect and create a new connection.