Welcome Guest, Not a member yet? Register   Sign In
AJAX process stopping other requests.
#1

I have an ajax function that takes from  1 minute up to 30 minutes depending upon data processing. But when the ajax function runs, other pages won't load. I tried many times but until the ajax completes, no other function will load. Am I doing something wrong or ajax works that way. Before this I only used ajax to get simple data so It would complete within microsecond so I thought ajax will work parallel to php process. 
PS. even if I open new tab nothing will load until the ajax is in process. I am using ajax in codeigniter 3.
Reply
#2

(This post was last modified: 05-20-2022, 09:03 PM by iRedds.)

It's most likely a session lock.
If the handler of the first request uses the session, then all other requests whose handlers also use the session will wait for the first one to complete.
You can try using the session_write_close() function in the long handler.
It will write to the session and end it.

You can also consider queues as a solution to your problem.

It looks like:
(request -> do something -> put job with payload to queue -> response ) <- quick request

(queue daemon -> get job -> execute -> await new job) <- long hard work
Reply
#3

Also make sure your using async:true
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Additionally, is your database table InnoDB or MyISAM ? Should be InnoDB.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB