Skip to content

Commit

Permalink
Ensure single listener notification on exceptional completion #2457
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Jul 20, 2023
1 parent e9c2495 commit a98c8e4
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/main/java/io/lettuce/core/CommandListenerWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ public RedisCommandListenerCommand(RedisCommand<K, V, T> command, Clock clock, M
}

@Override
public void complete() {
super.complete();

protected void doOnComplete() {
if (getOutput().hasError()) {

CommandFailedEvent failedEvent = new CommandFailedEvent((RedisCommand<Object, Object, Object>) command, context,
Expand All @@ -173,20 +171,15 @@ public void complete() {
}

@Override
public void cancel() {
super.cancel();
}

@Override
public boolean completeExceptionally(Throwable throwable) {

boolean state = super.completeExceptionally(throwable);

protected void doOnError(Throwable throwable) {
CommandFailedEvent failedEvent = new CommandFailedEvent((RedisCommand<Object, Object, Object>) command, context,
throwable);
listener.commandFailed(failedEvent);
}

return state;
@Override
public void cancel() {
super.cancel();
}

}
Expand Down

0 comments on commit a98c8e4

Please sign in to comment.