3
I have a PHP script that aims to integrate with a third party system.
Basically, my script sends image and text files to the client’s ftp.
To ensure processing for a long time, I use the following instruction:
ignore_user_abort( true ); // Não interrompe o script em caso de perda de conexão
set_time_limit( 21600 ); // Time out após 6h
Also, to prevent double processing, a file is created at the beginning which, at the end of the script, is deleted.
So that if the file exists, it is because the process is running.
The script works beautifully.
The problem is that this script is called via AJAX by my system (asynchronously), and is then run in the background. But then, once started the process, I can’t do anything else on the system until it ends, unless I open it in another browser or using another protocol (one with www and the other without).
This is browser limitation, or is something that can be configured on/php server?
Thanks in advance for the help!
Obs.: There are several processes running in the background in the system, but this is the only one that stops the other processes.
You’re making ajax synchronous?
– Sergio
@Sergio Access is naturally asynchronous. In fact the system does several processes in the background... this is the one that blocks other processing.
– Szag-Ot
@Szag-Ot, ok, can you explain further "I can’t do anything else in the system until it ends"? Who is blocking other processing?
– Sergio
@Sergio, any process/link/page of the same domain that you try to access, is not opened until the above mentioned process has ended. The browser is waiting. And in the case of other processes in the background, they are not executed until the end of this.
– Szag-Ot
busy socket, when releasing a vc uses, or alias, which is the case when you use www or 127.0.0.1 for example.
– user3873165