Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a way to run backend operations without timing out #465

Open
elguitar opened this issue Jan 22, 2021 · 3 comments
Open

Implement a way to run backend operations without timing out #465

elguitar opened this issue Jan 22, 2021 · 3 comments

Comments

@elguitar
Copy link
Contributor

WordPress timeouts, if there is no output received from a AJAX call.

This is a huge annoyance when running large tasks such as shadow reset.

We should find a way to periodically receive output from PHP exec function. This can possibly help: https://stackoverflow.com/questions/1281140/run-process-with-realtime-output-in-php

@Moppa5
Copy link
Contributor

Moppa5 commented Mar 17, 2021

I think the proc_open is the right approach for this. I managed to convert wp-test which is run on upkeep page to use the proc_open and with the given pipelines etc. for the data. There's also a good example on php.net about the usage of proc_open. This example also contains notes about deadlock if the pipelines aren't properly closed before proc_close.

However, the implementation needs more designing. For instance, do we want just a way to run these on background or having stream data between AJAX and PHP also? Either we could use this process approach when required by implementing it on heavy operations, or we could implement similar to Helpers class a way to execute a PHP process and the command assigned to it by calling a function.

@elguitar
Copy link
Contributor Author

Realtime streaming is not needed between the front and back. It could just poll every 5 seconds or something like that.

A helper method for this would be pretty great, because this feature is needed in several places.

@Moppa5
Copy link
Contributor

Moppa5 commented Jun 9, 2021

PHP processes don't seem to be the working solution solely. We should investigate and try out some RestAPI solution that can be integrated to Seravo Plugin. WordPress has its own RestAPI and we should investigate it https://developer.wordpress.org/rest-api/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants