cabol / nebulex_ecto

Nebulex and Ecto integration
MIT License
27 stars 5 forks source link

Unhandled Redis Connection Errors #6

Open sbennett33 opened 6 years ago

sbennett33 commented 6 years ago

Thanks for this library. Its super helpful!

We currently have nebulex_ecto configured to use the nebulex_redis_adapter and its working pretty well. The issue we're seeing currently is exceptions being thrown by the underlying redis adapter if there is a temporary disconnection. As this is a cacheing library, I'd expect the library to go to the repo if there was a problem reading the value from the cache instead of crashing my process.

Expected behavior: If there was an error trying to read data from the cache, the library should read the data from the db instead.

Observed behavior: Temporary disconnects cause nebulex_ecto to raise.

Stacktrace:

#PID<0.7956.9> running ApolloWeb.Endpoint (cowboy_protocol) terminated Server: 
apollo.fantag.live:80 (http) Request: GET / ** (exit) an exception was raised: 
** (Redix.ConnectionError) :disconnected (redix) 
lib/redix.ex:407: Redix.pipeline!/3 (nebulex_redis_adapter) 
lib/nebulex_redis_adapter.ex:358: NebulexRedisAdapter.with_ttl/4 (nebulex) 
lib/nebulex/cache/object.ex:12: Nebulex.Cache.Object.get/3 (fantag) 
lib/fantag/redis_cache.ex:2: Fantag.RedisCache.with_hooks/3 (fantag) 
lib/fantag/cacheable_repo.ex:2: Fantag.CacheableRepo.do_get/4 (fantag) 
lib/fantag/guardian.ex:16: Fantag.Guardian.resource_from_claims/1 (guardian) 
lib/guardian/plug/load_resource.ex:58: Guardian.Plug.LoadResource.resource/3 (guardian) 
lib/guardian/plug/load_resource.ex:49: Guardian.Plug.LoadResource.call/2

We are seeing the underlying redix library reconnecting automatically and subsequent requests to the cache are successful.

Sergei-Rudenkov commented 3 years ago

@sbennett33, did you find any workaround on this?