I need to filter products based on 3 attributes and display those attributes to storefront, I've about 25000 products, so filtering them in each request takes 20 seconds.

I thought about creating a cron job that run daily and returns the result.

the problem is how to pass the value from cron job controller to my module controller.

magento version is 2.1.7

2 Answers 2


Yommna, You might be wrong about Magento cronJob.It is doesn't perform from any controller. It is run from PHP CLI. If you check Magento own doc Then you will understand the concept cronjob. So, redirect transfer like the cron job to my module controller.It is not a physible solution

I don't know why you want to search over on 25000 Products.search over 25K product is not a good idea.it is effect server load.

If you want to perform a filter on cron job and use this result to your controller that could be possible.


I am not sure why exactly you need this but if you want to apply the same solution, what you can do is write down your logic in magento cron job and save the results some custom log file in json format. Now when your controller is called, you may read the log file and decode json and use the data. This way you can use cron result in your controller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.