Skip to content

Commit

Permalink
Do not queue when using bidirectional push
Browse files Browse the repository at this point in the history
  • Loading branch information
caalador committed Jan 10, 2025
1 parent 7a97b9a commit 45904e5
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,13 @@ private JsonObject preparePayload(final JsonArray reqInvocations,
* The contents of the request to send
*/
public void send(final JsonObject payload) {
if (!messageQueue.isEmpty()) {
if (!isPushCommunication()) {
if (!messageQueue.isEmpty()) {
messageQueue.add(payload);
return;
}
messageQueue.add(payload);
return;
}
messageQueue.add(payload);
sendPayload(payload);
}

Expand All @@ -237,7 +239,7 @@ private void sendPayload(final JsonObject payload) {
registry.getRequestResponseTracker().startRequest();
}

if (push != null && push.isBidirectional()) {
if (isPushCommunication()) {
// When using bidirectional transport, the payload is not resent
// to the server during reconnection attempts.
// Keep a copy of the message, so that it could be resent to the
Expand Down Expand Up @@ -271,6 +273,10 @@ public void run() {
}
}

private boolean isPushCommunication() {
return push != null && push.isBidirectional();
}

private void resetTimer() {
if (resendMessageTimer != null) {
resendMessageTimer.cancel();
Expand Down

0 comments on commit 45904e5

Please sign in to comment.