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

the method RRateLimiter.expire() is incorrect working #3756

Closed
91diy opened this issue Aug 3, 2021 · 1 comment
Closed

the method RRateLimiter.expire() is incorrect working #3756

91diy opened this issue Aug 3, 2021 · 1 comment
Labels

Comments

@91diy
Copy link

91diy commented Aug 3, 2021

this is my code :
`
String key = REDISSON_RATE_LIMIT + limit.prefix() + ":" +spel;
RRateLimiter rRateLimiter = redissonClient.getRateLimiter(key);
rRateLimiter.trySetRate(RateType.OVERALL, limit.rate(), limit.rateInterval(), limit.unit());

        if (limit.expireSecond() !=-1) {
            rRateLimiter.expire(limit.expireSecond(), TimeUnit.SECONDS);
        }

@RedissonRateLimit(prefix = "trade", spel = "#trade.rootMchId",
rate = 1, rateInterval = 2, unit = RateIntervalUnit.SECONDS, expireSecond = 5)
@PostMapping("/trade")
public ResponseEntity trade(@requestbody Trade trade) {
return ResponseEntity.ok("success");
}
`
then I fund a bug :
5 seconds have passed, the redis key “redisson_rate_limit:trade:rootMchId0001” has removed,but the redis key
"{redisson_rate_limit:trade:rootMchId0001}:permits" and “{redisson_rate_limit:trade:rootMchId0001}:value ” still exist.

Who knows you can help me?please...

@91diy 91diy added the question label Aug 3, 2021
@mrniko
Copy link
Member

mrniko commented Aug 3, 2021

Fixed in #2931

@mrniko mrniko closed this as completed Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants