scala-redis icon indicating copy to clipboard operation
scala-redis copied to clipboard

PubSub: exception processing is difficult to recover from

Open skandragon opened this issue 9 years ago • 1 comments

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?

skandragon avatar Aug 17 '16 20:08 skandragon

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.

debasishg avatar Aug 18 '16 14:08 debasishg