Skip to content

Commit

Permalink
Move call to getMessageHandler().onResynchronize(); to right place (#…
Browse files Browse the repository at this point in the history
…12178) (#12184)

#12043 changed resync message sending to be deferred to queue. Now also the setting of the semaphor in message handler needs to be deferred to its right place. Otherwise there is possibility for a timing glitch. I.e. MessageHandler is set to resync handling mode before message is actually send.

Fixes: #12151

Authored-by: Tatu Lund <[email protected]>
  • Loading branch information
Ansku authored Jan 22, 2021
1 parent e07e3d0 commit 096fc1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private void doSendInvocationsToServer() {
}
if (resynchronizeRequested) {
getLogger().info("Resynchronizing from server");
getMessageHandler().onResynchronize();
extraJson.put(ApplicationConstants.RESYNCHRONIZE_ID, true);
resynchronizeRequested = false;
}
Expand Down Expand Up @@ -356,7 +357,6 @@ private VLoadingIndicator getLoadingIndicator() {
* state from the server
*/
public void resynchronize() {
getMessageHandler().onResynchronize();
getLogger().info("Resynchronize from server requested");
resynchronizeRequested = true;
sendInvocationsToServer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
import com.vaadin.annotations.PreserveOnRefresh;
import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.Transport;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Label;

@PreserveOnRefresh
@Push
@Push(transport = Transport.WEBSOCKET_XHR)
public class PushWithPreserveOnRefresh extends AbstractReindeerTestUI {

private Log log = new Log(5);
private int times = 0;

@Override
protected void setup(VaadinRequest request) {
setTheme("valo");
// Internal parameter sent by vaadinBootstrap.js,
addComponent(new Label("window.name: " + request.getParameter("v-wn")));
addComponent(new Label("UI id: " + getUIId()));
Expand Down

0 comments on commit 096fc1d

Please sign in to comment.