Fixed - RRateLimiter.delete() method returns false. #3099

pull/3118/head
Nikita Koksharov 4 years ago
parent 06c6214035
commit ba31cf0901

@ -328,7 +328,7 @@ public interface RedisCommands {
RedisStrictCommand<Long> DEL = new RedisStrictCommand<Long>("DEL");
RedisStrictCommand<Long> DBSIZE = new RedisStrictCommand<Long>("DBSIZE");
RedisStrictCommand<Boolean> DEL_BOOL = new RedisStrictCommand<Boolean>("DEL", new BooleanNullSafeReplayConvertor());
RedisStrictCommand<Boolean> DEL_OBJECTS = new RedisStrictCommand<Boolean>("DEL", new BooleanNullSafeReplayConvertor());
RedisStrictCommand<Boolean> DEL_OBJECTS = new RedisStrictCommand<Boolean>("DEL", new BooleanAmountReplayConvertor());
RedisStrictCommand<Void> DEL_VOID = new RedisStrictCommand<Void>("DEL", new VoidReplayConvertor());
RedisStrictCommand<Long> UNLINK = new RedisStrictCommand<Long>("UNLINK");

@ -164,7 +164,22 @@ public class RedissonRateLimiterTest extends BaseTest {
Thread.sleep(1050);
}
}
@Test
public void testRemove() {
RRateLimiter rateLimiter = redisson.getRateLimiter("test");
assertThat(rateLimiter.delete()).isFalse();
rateLimiter.trySetRate(RateType.OVERALL, 5L, 5L, RateIntervalUnit.MINUTES);
assertThat(redisson.getKeys().count()).isEqualTo(1);
rateLimiter.tryAcquire();
boolean deleted = rateLimiter.delete();
assertThat(redisson.getKeys().count()).isEqualTo(0);
assertThat(deleted).isTrue();
}
@Test
public void testConcurrency() throws InterruptedException {
RRateLimiter rr = redisson.getRateLimiter("test");

Loading…
Cancel
Save