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

Upgrading to 1.1.0 breaks the count method #48

Open
knightq opened this issue Jan 23, 2024 · 2 comments
Open

Upgrading to 1.1.0 breaks the count method #48

knightq opened this issue Jan 23, 2024 · 2 comments

Comments

@knightq
Copy link

knightq commented Jan 23, 2024

The count method (changed in 1.1.0) is no longer returning (or sometimes may return) a nil, while previously an integer was always returned.

@andreasknoepfle
Copy link
Collaborator

andreasknoepfle commented Jan 24, 2024

Hi @knightq can you give us some more details here? Ideally your version of redis used & a minimal example producing 0?

To me this seems weird, since from the lua script, that would mean that nothing is returned, but we should always return something there. Maybe the lua script silently errors and returns nil?
Can you also check if there is something in the logs of redis (maybe it logs script errors somewhere).

@renatovico
Copy link

break the connection pool too

I setup Ratelimit with :

Ratelimit.new(rate_limit_key, {redis: Rails.cache.redis})

this implicit use the connection Pool

Backtrace:

undefined method `script' for #<ConnectionPool:0x00007f8729861b88 @size=5, @timeout=5, @auto_reload_after_fork=true, @available=#<ConnectionPool::TimedStack:0x00007f8729861a98 @create_block=#<Proc:0x00007f872b6a9938 /home/renato/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/activesupport-7.1.4/lib/active_support/cache/redis_cache_store.rb:153>, @created=1, @que=[#<Redis client v5.3.0 for redis://localhost:6379>], @max=5, @mutex=#<Thread::Mutex:0x00007f872b6a96e0>, @resource=#<Thread::ConditionVariable:0x00007f872b6a9438>, @shutdown_block=nil>, @key=:"pool-11400", @key_count=:"pool-11400-count"> /home/renato/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/ratelimit-1.1.0/lib/ratelimit.rb:165:in `load_scripts'
/home/renato/.rbenv/versions/3.2.3/lib/ruby/gems/3.2.0/gems/ratelimit-1.1.0/lib/ratelimit.rb:62:in `initialize'

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

3 participants