Skip to content

Commit 3109c3b

Browse files
authored
Merge pull request #6970 from bandalgomsu/gh-6944
Fix CommandDecoder to handle BUSY error prefix
2 parents e8fbfc5 + 8a29329 commit 3109c3b

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

redisson/src/main/java/org/redisson/client/handler/CommandDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ protected void decode(ByteBuf in, CommandData<Object, Object> data, List<Object>
419419
} else if (error.startsWith("MASTERDOWN")) {
420420
data.tryFailure(new RedisMasterDownException(error
421421
+ ". channel: " + channel + " data: " + data));
422-
} else if (error.startsWith("BUSY")) {
422+
} else if (error.startsWith("BUSY ")) {
423423
data.tryFailure(new RedisBusyException(error
424424
+ ". channel: " + channel + " data: " + data));
425425
} else if (error.startsWith("WAIT") || error.startsWith("ERR WAIT")) {

redisson/src/test/java/org/redisson/RedissonStreamTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.redisson.api.*;
77
import org.redisson.api.listener.StreamAddListener;
88
import org.redisson.api.stream.*;
9+
import org.redisson.client.RedisBusyException;
910
import org.redisson.client.RedisException;
1011
import org.redisson.client.protocol.StreamEntryStatus;
1112

@@ -64,6 +65,19 @@ public void testEmptyMap() {
6465
assertThat(result).hasSize(1);
6566
}
6667

68+
@Test
69+
public void testBusyGroupIsNotRetryException() {
70+
RStream<String, String> stream = redisson.getStream("test");
71+
stream.createGroup(StreamCreateGroupArgs.name("group").makeStream());
72+
73+
RedisException ex = Assertions.assertThrows(RedisException.class, () -> {
74+
stream.createGroup(StreamCreateGroupArgs.name("group").makeStream());
75+
});
76+
77+
assertThat(ex).isNotInstanceOf(RedisBusyException.class);
78+
assertThat(ex.getMessage()).startsWith("BUSYGROUP");
79+
}
80+
6781
@Test
6882
public void testAutoClaim() throws InterruptedException {
6983
RStream<String, String> stream = redisson.getStream("test");

0 commit comments

Comments
 (0)