views:

275

answers:

3

Hey All.

I recently started testing TornadoWeb for a home-project, which uses jquery getJSON function to call my tornado handlers. And found something strange, which i seek an explanation for.

I fire an ajax request for Handler1 on tornado, and in some cases request for Handler2 is initiated before Handler1 returns. It appears from development-server logs, and firebug console-debugging, that Handler2 request waits for Handler1 request to finish, and then return. So basically, XHR call is waiting for earlier XHRs. They are supposed to be asynchronous/non-blocking right?? Or am i missing something.

You can check the test-case environment called testtornado at http://github.com/harshh/Harsh-Projects/ with main.py as server triggering file.

I would appreciate help from anyone who can throw some light on this.

A: 

Would you be able to share a little more information about the call you are trying to make in jquery. If you could, could you post an example of the javascript that you are trying to execute.

scptre
The whole code is in github repository stated in my question.
simplyharsh
A: 

Hi Harshh,

After reviewing your test.js file, get_handler1 and get_handler2 are entirely independent of each other. However, your browser or proxy (if you're using one) may be enforcing a one request per domain limit which would cause your XHR requests to appear to be synchronous. Popular HTTP debugging proxies such as Fiddler can enforce such limits -- browsers also tend to have settings which you can modify to ensure your browser will issue more than one request per domain concurrently.

Macy Abbey
A: 

Couldn't get better explanations here. Although some better insights can be found Tornado group discussion. Thanks.

simplyharsh