Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
caalador committed Jan 13, 2025
1 parent aefbb0a commit c604efb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ private void doSendInvocationsToServer() {
sendPayload(payload);
return;
} else if (hasQueuedMessages() && resendMessageTimer == null) {
if (!registry.getRequestResponseTracker().hasActiveRequest()) {
registry.getRequestResponseTracker().startRequest();
}
sendPayload(messageQueue.get(0));
return;
}
Expand Down Expand Up @@ -228,8 +225,9 @@ public void send(final JsonObject payload) {
private void sendPayload(final JsonObject payload) {
payload.put(ApplicationConstants.SERVER_SYNC_ID,
registry.getMessageHandler().getLastSeenServerSyncId());
// clientID should only be set and updated if payload doesn't contain
// clientID. If one exists we are probably trying to resend.
if (!payload.hasKey(ApplicationConstants.CLIENT_TO_SERVER_ID)) {
// We are resending the message so we should not up the clientId
payload.put(ApplicationConstants.CLIENT_TO_SERVER_ID,
clientToServerMessageId++);
}
Expand Down Expand Up @@ -381,15 +379,13 @@ public void setClientToServerMessageId(int nextExpectedId, boolean force) {
pushPendingMessage = null;
}
if (hasQueuedMessages()) {
synchronized (messageQueue) {
// If queued message is the expected one. remove from queue
// and sen next message if any.
if (messageQueue.get(0)
.getNumber(ApplicationConstants.CLIENT_TO_SERVER_ID)
+ 1 == nextExpectedId) {
resetTimer();
messageQueue.remove(0);
}
// If queued message is the expected one. remove from queue
// and send next message if any.
if (messageQueue.get(0)
.getNumber(ApplicationConstants.CLIENT_TO_SERVER_ID)
+ 1 == nextExpectedId) {
resetTimer();
messageQueue.remove(0);
}
}
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public void endRequest() {
hasActiveRequest = false;

if ((registry.getUILifecycle().isRunning()
&& (registry.getServerRpcQueue().isFlushPending())
&& registry.getServerRpcQueue().isFlushPending())
|| registry.getMessageSender()
.getResynchronizationState() == ResynchronizationState.SEND_TO_SERVER
|| registry.getMessageSender().hasQueuedMessages())) {
|| registry.getMessageSender().hasQueuedMessages()) {
// Send the pending RPCs immediately.
// This might be an unnecessary optimization as ServerRpcQueue has a
// finally scheduled command which trigger the send if we do not do
Expand Down

0 comments on commit c604efb

Please sign in to comment.