Reputation: 372
I have created a dashboard for my application with multiple widgets. Each widget having its own corresponding functions. During the initial load of the dashboard all widgets are calling their own functions through $(document).ready() with ajax. The problem with this scenario is at a time only one function is executed and only after successful execution of first function second one executed, like wise all remaining functions are executed. If am having 10 widgets then all are displayed one after another.
I need to execute all functions simultaneously based on their execution time. What i mean is one widget should not wait for the completion of other widget to finish but has to process and display the results simultaneously as and when its function completes its process.
Upvotes: 2
Views: 296
Reputation: 372
Finally i got the answer for above problem,
Am using file based session, So PHP will lock session files for each request and maintain that lock until the script terminates/exits.
If we need to unlock the PHP Session file in our script, we can use session_write_close()
in our script. That will unlock the session file and will utilize the same for that instance.
In the same time the session_write_close()
function will make all requests as serial, because all requests struggling for the same single session file.
So from session_write_close()
, i have rectified my problem.
Thank you @kalpeshpatel and @iJD for your response.
Upvotes: 3