sorentwo / readthis

:newspaper: Pooled active support compliant caching with redis
MIT License
504 stars 40 forks source link

Getting error when Redis is down - Errno::EINVAL: Invalid argument #51

Closed inyigo closed 7 years ago

inyigo commented 7 years ago

Hello. I am trying this out on my development environment. First thing I tested is the

Readthis.fault_tolerant = true

I am getting intermittent error using the cache when redis is down.

[275] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
Errno::EINVAL: Invalid argument
from /Users/inyigo/.rvm/gems/ruby-2.2.1@hkakabo/gems/redis-3.2.2/lib/redis/connection/hiredis.rb:17:in `connect'

[276] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
=> "test"
# ok here

[277] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
Errno::EINVAL: Invalid argument
from /Users/inyigo/.rvm/gems/ruby-2.2.1@hkakabo/gems/redis-3.2.2/lib/redis/connection/hiredis.rb:17:in `connect'

[278] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
=> "test"
# ok here

[279] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
Errno::EINVAL: Invalid argument

[378] pry(main)> Rails.cache.fetch("test_data")
Errno::EINVAL: Invalid argument

[32] pry(main)> Rails.cache.fetch("test_data")
=> nil

Works perfectly when redis is up

[304] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
=> "test"
[305] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
=> "test"
[306] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
=> "test"
[307] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
=> "test"
[308] pry(main)> Rails.cache.fetch("test_data", expires_in: 6.hours) { 'test' }
=> "test"
[367] pry(main)> Rails.cache.fetch("test_data")
=> "test"
[368] pry(main)> Rails.cache.fetch("test_data")
=> "test"
[369] pry(main)> Rails.cache.fetch("test_data")
=> "test"

Am I doing something wrong?

inyigo commented 7 years ago

Checking it here.. https://github.com/redis/hiredis-rb/issues/21

Will update if I have figured out what's going on

inyigo commented 7 years ago

Closing as this is hiredis issue. I am using default driver for now.