Problem
I have a long import job that I start with an ajax request, it can take several minutes until the request is complete. While this first ajax request is running, I want to look at the server to find out how far the import will disappear, this second request will be executed every 2 seconds or so.
When I use the Ext.Ajax method, the requests seem to be chained - the first ajax request (import) is executed until it is complete, then the second one (import update) will be launched.
I saw that Ext.Ajax is singleton, so maybe the reason. So I tried to create my own Connection objects using Ext.create('Ext.data.Connection') , but it does not work.
My request chain :
- first request - start
- first request - end
- second request - start
- second request - end
But it should be:
- first request - start
- second request - start
- second request - end
- ... maybe more second queries
- first request - end
Question
The browser should be able to handle multiple requests, there should be a limitation inside ExtJS, but I did not find it?
Update 2011-10-16
Answer
The problem is not ExtJS - sorry! It was PHP, my first script works with the session, and the second script also tried to access the session. And since PHP sessions are file-based, the session file was locked from the first script request, and the second script request had to wait until the first release of the session lock.
I solved this with this small piece of code, which I added to my import process (first script) after each line of x:
$id = session_id(); session_write_close(); sleep(1); session_start($id);
This way it stops and reloads the session, and another script was able to connect and get session information.
source share