BATU
February 11, 2021, 4:18pm
1
I type really fast Cmd+Z and Cmd+Y, to stress test the Incremental JSON saving performance,
it will be emit the Incremental JSON , in almost case.
insertNodes […]
removeNodes […]
insertNodes […]
removeNodes […]
But sometimes I received the Incremental JSON strange order, that is,
removeNodes […]
insertNodes […]
insertNodes […]
removeNodes […]
Could you confirm it is possible ?
Maybe model change event is not stable ordering ?
for guarantee order I am using promise.then(…), even so it happens.
walter
February 11, 2021, 4:23pm
2
What do you mean by “receive the Incremental JSON”?
BATU
February 11, 2021, 4:24pm
3
receive the Incremental JSON” at server side.
BATU
February 11, 2021, 4:30pm
4
I mean, removeNodes […] came first, it actually, insertNodes happens first.
walter
February 11, 2021, 4:36pm
5
Are you sending messages in separate TCP connections? The messages can arrive out-of-order.
BATU
February 11, 2021, 4:44pm
6
I think same as you The TCP reordering, but now I use Promise to sent incre. JSON to server. then send next.
walter
February 11, 2021, 4:50pm
7
That doesn’t change anything. Messages sent in different TCP connections can arrive in any order.
Normally the receiver of any sequence of messages will sort them into an acceptable ordering.
BATU
February 11, 2021, 4:55pm
8
Thank you, I let me more dig in to this.
BATU
February 11, 2021, 4:56pm
9
By the way the promise implement i refer this page
BATU
February 11, 2021, 5:03pm
10
so I think, It is send one Json to the server, sever respond , then send next JSON to server, so it not possible TCP reorder it. If you feel , Gojs not possible emit event in different order, that is fine, i research my code more.
walter
February 11, 2021, 5:33pm
11
I don’t know how you are communicating with the server, but it seems highly likely that you chose a protocol that is asynchronous. You aren’t waiting for an answer before sending the second message, are you? So you sent msg #1 and then msg #2 , but then it is possible for the server to receive #2 and then #1 .
BATU
February 11, 2021, 5:48pm
12
Yes it is my Promise code bug. I already fixed it, thank you walter!
now it no problem with my crazy fast Cmd+Z and Cmd+Y. no order problem!