I have a module that imports some 10K shops (addresses, details, etc.) from a remote webservice to Magento. At the end of the import, I need to run a specific indexing.
The import part works fine (takes about 1 minute), but the indexing fails about 50% of the time. I was using the following code:
$process = Mage::getSingleton('index/indexer')->getProcessByCode('shop_indexer'); $process->reindexEverything();
Now I have read about another way to run the indexing. I have removed everything from my module and left only the following code:
$process = Mage::getSingleton('index/indexer')->getProcessByCode('shop_indexer'); $process->walk('reindexAll');
But this fails every time.
I get an error on the frontend: There has been an error processing your request
Edit: the above error was due to another issue in my module. Now I get no error display on the frontend, but still:
I get nothing in the system.log file.
What would be the correct approach to:
- Import data to the Magento database
- Run a reindex after the import has finished
- Log the results of the reindexing (log something if it succeeds or fails)
Edit: What I don't understand is that reindexing fails when ran from my script, but doing it manually from the backend works fine. What am I missing?
Thanks in advance for any help on that!