QuentinJou Posted April 26, 2022 Share Posted April 26, 2022 (edited) Hello, I am currently developing a module that imports products into Prestashop but it takes a long time to process so I would like to do it alongside running prestashop/in the background. Is it possible to do this? if yes how can i do? Thank you for the help Edited April 26, 2022 by QuentinJou (see edit history) Link to comment Share on other sites More sharing options...
Gneston Posted April 26, 2022 Share Posted April 26, 2022 Multithreading and php. A nightmare But there are different solutions like pthreads or parallel. But do you really have to run the import in the background? php and prestashop can handle multiple requests at a time, so you can still work in your shop, while the import is handled in another process. Link to comment Share on other sites More sharing options...
QuentinJou Posted April 26, 2022 Author Share Posted April 26, 2022 (edited) Thank you for that answer. I see that...😅 I tried in parallel. It works in terminal but not in my webserver so I don't know if we can do with it? For the multiple process of prestashop is it activated basic? I'm running my function in a back office hook like that, but can't do anything else beside it. Is it the good process ? How can I do this? public function hookDisplayBackOfficeHeader() { if (Tools::getIsSet('initProduct')) { $this->initAll(); } $redirect = $_SERVER['REQUEST_URI'] . '&initProduct=1'; $this->context->smarty->assign( [ 'redirect' => $redirect, ] ); } (sorry for my bad english) Edited April 26, 2022 by QuentinJou (see edit history) Link to comment Share on other sites More sharing options...
Gneston Posted April 26, 2022 Share Posted April 26, 2022 You can configure how many php processes your webserver is allowed to start. Read here: https://www.php.net/manual/en/install.fpm.configuration.php Depending on your php configuration it should be pm.max_children which should be larger than 1. Or like it is written here Quote Inside this file, the most important setting is the pm.max_children setting. It must be greater than the max number of concurrent users you want to simulate during the bench. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now