Intro: I'm a Python(Django) developer who is working at a company where
we use Magento in the backend to sell products on our website. I'm not
really experienced in Magento. We are using
Magento version 22.214.171.124.
What I want: On certain events like new product/order/customer create, I want Magento to do some functions. Eg: For new product create, I want magento to call a celery task which will check certain conditions and send an email to the site merchandiser if some data is wrong.
What I have done: As far as I understand, Magento has an event like
_save_after which is triggered after a new product is saved. Using
this, Magento is calling the celery task with the
entity_id of the
product on this even trigger. When the celery task is triggered, I'm
querying the database(
catalog_product_entity table) for the product using the
entity_id sent from
Issue: In some cases, when I'm querying the database for the newly created product, the database returns 0 rows. This happens almost all the time.
What I think: I think, there might be some sort of asynchronous queueing done in Magento which is causing this issue. Can someone give me an explanation to this and let me know how to fix this issue?
I've searched a lot about this and still not able to figure what caused this.