methods are sync between all clients?

124 views
Skip to first unread message

Vianney Lecroart

unread,
Feb 25, 2015, 9:04:38 AM2/25/15
to meteo...@googlegroups.com

cd test-asyncmethod
meteor

open 2 browsers tabs on http://localhost:3000

on both, click on the button.

you'll see that the 10 calls on both tabs are send immediately (normal)
you'll see answer received one by one, every 3 seconds (normal because on the server, methods from a given client run one at a time. The N+1th invocation from a client won't start until the Nth invocation returns)

BUT the other tab will receive his first answer only after the 10th call of the first tab is over.

Here is the output for the first tab:

0 start Wed Feb 25 2015 14:56:15 GMT+0100
1 start Wed Feb 25 2015 14:56:15 GMT+0100
2 start Wed Feb 25 2015 14:56:15 GMT+0100
3 start Wed Feb 25 2015 14:56:15 GMT+0100
4 start Wed Feb 25 2015 14:56:15 GMT+0100
5 start Wed Feb 25 2015 14:56:15 GMT+0100
6 start Wed Feb 25 2015 14:56:15 GMT+0100
7 start Wed Feb 25 2015 14:56:15 GMT+0100
8 start Wed Feb 25 2015 14:56:15 GMT+0100
9 start Wed Feb 25 2015 14:56:15 GMT+0100
0 done 3.003 stop Wed Feb 25 2015 14:56:18 GMT+0100 3.002
1 done 3 stop Wed Feb 25 2015 14:56:21 GMT+0100 6.002
2 done 3.001 stop Wed Feb 25 2015 14:56:24 GMT+0100 9.003
3 done 3 stop Wed Feb 25 2015 14:56:27 GMT+0100 12.003
4 done 3 stop Wed Feb 25 2015 14:56:30 GMT+0100 15.003
5 done 3 stop Wed Feb 25 2015 14:56:33 GMT+0100 18.003
6 done 3 stop Wed Feb 25 2015 14:56:36 GMT+0100 21.003
7 done 3 stop Wed Feb 25 2015 14:56:39 GMT+0100 24.003
8 done 3 stop Wed Feb 25 2015 14:56:42 GMT+0100 27.003
9 done 3 stop Wed Feb 25 2015 14:56:45 GMT+0100 30.003


and the second  tab:

0 start Wed Feb 25 2015 14:56:16 GMT+0100
1 start Wed Feb 25 2015 14:56:16 GMT+0100
2 start Wed Feb 25 2015 14:56:16 GMT+0100
3 start Wed Feb 25 2015 14:56:16 GMT+0100
4 start Wed Feb 25 2015 14:56:16 GMT+0100
5 start Wed Feb 25 2015 14:56:16 GMT+0100
6 start Wed Feb 25 2015 14:56:16 GMT+0100
7 start Wed Feb 25 2015 14:56:16 GMT+0100
8 start Wed Feb 25 2015 14:56:16 GMT+0100
9 start Wed Feb 25 2015 14:56:16 GMT+0100
0 done 3 stop Wed Feb 25 2015 14:56:48 GMT+0100 31.773
1 done 3 stop Wed Feb 25 2015 14:56:51 GMT+0100 34.773
2 done 3 stop Wed Feb 25 2015 14:56:54 GMT+0100 37.773
3 done 3 stop Wed Feb 25 2015 14:56:57 GMT+0100 40.773
4 done 3 stop Wed Feb 25 2015 14:57:00 GMT+0100 43.773
5 done 3 stop Wed Feb 25 2015 14:57:32 GMT+0100 75.505
6 done 3 stop Wed Feb 25 2015 14:57:32 GMT+0100 75.505
7 done 3 stop Wed Feb 25 2015 14:57:32 GMT+0100 75.506
8 done 3 stop Wed Feb 25 2015 14:57:32 GMT+0100 75.506
9 done 3 stop Wed Feb 25 2015 14:57:32 GMT+0100 75.507

(second strange thing is that on the second tab, 5-9 answers are received exactly at the same time, 14:57:32)


It should block per client, not globally (or the doc is not clear). Am I missing something?

Vianney Lecroart


PS: I welcome VSRE emails!

Vianney Lecroart

unread,
Feb 25, 2015, 9:17:50 AM2/25/15
to meteo...@googlegroups.com
Okay, my bad

It's because the loop I do to wait 3 seconds on the server is not event friendly. I changed with a http.get() that took 3 seconds and in this case, it works fine.
Reply all
Reply to author
Forward
0 new messages