Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis can crash at boot #16

Open
sfcgeorge opened this issue Jul 25, 2023 · 0 comments
Open

Redis can crash at boot #16

sfcgeorge opened this issue Jul 25, 2023 · 0 comments

Comments

@sfcgeorge
Copy link

If there's something wrong with Redis this will crash the app at boot. In our case Error undefined method smembers for RedisClient, but I think the specific error is less important than generally robust error handling.

I see this as a "nice to have" gem, so I'd rather it fail to record usage than crash at boot. IMO the whole internal Redis code in the gem should be wrapped in a rescue.

undefined method `smembers' for #<RedisClient::Pooled:0x00007fbc14110350 @config=#<RedisClient::Config:0x00007fbc14110c88 @username=nil, @password="REDACTED", @db=0, @id=nil, @ssl=true, @ssl_params=nil, @connect_timeout=1.0, @read_timeout=1.0, @write_timeout=1.0, @driver=RedisClient::RubyConnection, @custom={}, @client_implementation=RedisClient, @protocol=3, @command_builder=RedisClient::CommandBuilder, @inherit_socket=false, @reconnect_attempts=false, @connection_prelude=[["HELLO", "3", "AUTH", "default", "REDACTED"]], @circuit_breaker=nil, @middlewares_stack=RedisClient::Middlewares, @host="eu1-harmless-mako-39326.upstash.io", @port=39326, @path=nil>, @id=nil, @connect_timeout=1.0, @read_timeout=1.0, @write_timeout=1.0, @command_builder=RedisClient::CommandBuilder, @pid=2, @pool_kwargs={:timeout=>0.5, :size=>5}, @pool=#<ConnectionPool:0x00007fbc143d2598 @size=5, @timeout=0.5, @auto_reload_after_fork=true, @available=#<ConnectionPool::TimedStack:0x00007fbc143d2548 @create_block=#<Proc:0x00007fbc1410fe50 /usr/local/bundle/gems/redis-client-0.14.1/lib/redis_client/pooled.rb:83>, @created=0, @que=[], @max=5, @mutex=#<Thread::Mutex:0x00007fbc1410fdd8>, @resource=#<Thread::ConditionVariable:0x00007fbc1410fd88>, @shutdown_block=nil>, @key=:"pool-72220", @key_count=:"pool-72220-count">, @mutex=#<Thread::Mutex:0x00007fbc1410fb08>> (NoMethodError)

        members = DeadCodeDetector.config.redis.smembers(key)
                                               ^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant