Skip to content

Commit

Permalink
WebSockets Next: attempt to diagnose flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkouba committed Mar 7, 2024
1 parent b1a3686 commit 635688c
Showing 1 changed file with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,18 @@ protected Uni<Void> sendText(String message, boolean broadcast) {
}

protected Uni<Void> multiText(Multi<Object> multi, boolean broadcast, Function<Object, Uni<Void>> itemFun) {
multi.onFailure().call(connection::close).subscribe().with(
m -> {
itemFun.apply(m).subscribe().with(v -> LOG.debugf("Multi >> text message: %s", connection),
t -> LOG.errorf(t, "Unable to send text message from Multi: %s", connection));
});
multi.onFailure()
.call(connection::close)
.subscribe().with(
m -> {
itemFun.apply(m)
.subscribe()
.with(v -> LOG.debugf("Multi >> text message: %s", connection),
t -> LOG.errorf(t, "Unable to send text message from Multi: %s", connection));
},
t -> {
LOG.errorf(t, "Unable to send text message from Multi - connection was closed: %s ", connection);
});
return Uni.createFrom().voidItem();
}

Expand All @@ -221,11 +228,18 @@ protected Uni<Void> sendBinary(Buffer message, boolean broadcast) {
}

protected Uni<Void> multiBinary(Multi<Object> multi, boolean broadcast, Function<Object, Uni<Void>> itemFun) {
multi.onFailure().call(connection::close).subscribe().with(
m -> {
itemFun.apply(m).subscribe().with(v -> LOG.debugf("Multi >> binary message: %s", connection),
t -> LOG.errorf(t, "Unable to send binary message from Multi: %s", connection));
});
multi.onFailure()
.call(connection::close)
.subscribe().with(
m -> {
itemFun.apply(m)
.subscribe()
.with(v -> LOG.debugf("Multi >> binary message: %s", connection),
t -> LOG.errorf(t, "Unable to send binary message from Multi: %s", connection));
},
t -> {
LOG.errorf(t, "Unable to send text message from Multi - connection was closed: %s ", connection);
});
return Uni.createFrom().voidItem();
}
}

0 comments on commit 635688c

Please sign in to comment.