Skip to content
This repository was archived by the owner on Feb 9, 2019. It is now read-only.
This repository was archived by the owner on Feb 9, 2019. It is now read-only.

redis plugin: redis server downtime not handled gracefully #159

Description

@infomofo

I'd like to use a redis cache for content caching in my play server.

I have a play action that i'm wrapping with the Cached action, i.e.

 def action(input: String) = Cached.status(_ => "cachekey", 200, 43200) {
    Action {implicit request =>

The play plugin for redis works great. However i realized I'm introducing a new point of failure into my system.

If the redis server ever becomes unavailable, then my Cached server action call throws a hard exception

Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Broken pipe
    at redis.clients.jedis.Connection.flush(Connection.java:70) ~[jedis-2.4.2.jar:na]
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:173) ~[jedis-2.4.2.jar:na]
    at redis.clients.jedis.Jedis.set(Jedis.java:54) ~[jedis-2.4.2.jar:na]
    at com.typesafe.plugin.RedisPlugin$$anon$1$$anonfun$set_$2.apply(RedisPlugin.scala:145) ~[play-plugins-redis_2.11-2.3.1.jar:2.3.1]
    at com.typesafe.plugin.RedisPlugin$$anon$1$$anonfun$set_$2.apply(RedisPlugin.scala:144) ~[play-plugins-redis_2.11-2.3.1.jar:2.3.1]
    at org.sedis.Pool.withJedisClient(sedis.scala:103) ~[sedis_2.11-1.2.2.jar:na]
    at com.typesafe.plugin.RedisPlugin$$anon$1.set_(RedisPlugin.scala:144) ~[play-plugins-redis_2.11-2.3.1.jar:2.3.1]
    at com.typesafe.plugin.RedisPlugin$$anon$1.set(RedisPlugin.scala:103) ~[play-plugins-redis_2.11-2.3.1.jar:2.3.1]
    at play.api.cache.Cache$.set(Cache.scala:61) ~[play-cache_2.11-2.3.9.jar:2.3.9]

Is there a recommended pattern to deal with redis server downtime gracefully using this plugin and pattern? Ideally I would like the play caching api itself to log a hard exception but return the result as if it were a cache miss.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions