I am running WordPress with a self-made plugin that includes a function that fetches some information from different sources. If I start that function, which often runs up to 2 minutes, the server doesn’t respond to any frontend requests made – i.e. website visitors won’t get a server response while the plugin function is running.
Does someone have an idea on how solve this?
This could be because PHP blocks multiple requests that use the same sessions.
If your long-running script started a session, no other requests from the same user will be served until that script has either ended, or closed down the session.
If your long-running script doesn’t need any session specific data, you could try running
session_write_close()
at the start of the script (but after embedding the WP header files) and see whether it works any better.