question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RRateLimiter does not provide way to overwrite config

See original GitHub issue

Expected behavior

RRateLimiter does not have a setRate/setRateAsync method.

It only has trySetRate/trySetRateAsync methods, so once a rate-limiter’s config is persisted to Redis, it cannot be overwritten.

Actual behavior

Invoking RRateLimiter.trySetRate twice with different rate-limiter configuration values does not overwrite, since it uses HSETNX instead of HSET operation.

Steps to reproduce or test case

RRateLimiter rateLimiter = redisson.getRateLimiter("myRateLimiter");
boolean success;
success = rateLimiter.trySetRate(RateType.OVERALL, 1, 1, RateIntervalUnit.SECONDS);
System.out.println(success); // "true"
success = rateLimiter.trySetRate(RateType.OVERALL, 2, 2, RateIntervalUnit.SECONDS);
System.out.println(success); // "false"

There is no way to overwrite the existing "myRateLimiter" with a different rate, besides modifying the rate limiter name

Redis version

4.0.11

Redisson version

3.11.2

Redisson configuration

N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mrnikocommented, Aug 28, 2020

Merged

1reaction
pc-mmautnercommented, Nov 12, 2019

@mrniko that is what I ended up doing, using an RMap object w/ the same name as my RRateLimiter.

I (and @kmartin I think) were expecting a less janky way to do this, using methods exposed via the RRateLimiter interface

Read more comments on GitHub >

github_iconTop Results From Across the Web

RRateLimiter (Redisson 3.11.6 API) - javadoc.io
Returns current configuration of this RateLimiter object. ... If no permit is available then this method will return immediately with the value false...
Read more >
Improving Concurrency in Redis Rate Limiting System - Rockset
We use a rate limiting system, based on Redis, to protect services from overload. Learn how we increased its concurrency and scalability in ......
Read more >
org.redisson.api.RRateLimiter Java Examples
The following examples show how to use org.redisson.api.RRateLimiter ... RedissonClient client = Redisson.create(config); RRateLimiter rateLimiter = client.
Read more >
CHANGELOG.md · master · edNb8H / Redisson · GitCode
breaking change - spring.redis.redisson.config setting renamed to ... Fixed - RRateLimiter.delete() method doesn't delete all allocated Redis objects
Read more >
P-GW Administration Guide, StarOS Release 21.22 - Cisco
The UE Overload Protection feature provides a mechanism to monitor ... Otherwise, the values are not programmed in the fast path, instead, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found