PHP返回错误504(异步调用的负载过多?)

I'm running php and nodejs. I run some code in php and since I want the next code to be async without resorting to threading I send the information to nodejs and nodejs makes a new call to php. This works perfectly. However, the code to run async has to sleep and might occurr per logged in user - as to say: it will be run a lot. I noticed that when running only ONE single task regarding that script and trying to access index.php at the same time, the browser query to the server was put on hold indefinitely (loading, loading, loading, ...) and lastly crashed with a 504 served. My question here being: maintaining the algorithm I designed, is there any tweak I should do regarding max_time_out in relation to sleep? Or should I just "sleep" in nodejs and send the data to PHP? Tyvm, will provide more detail if needed...