Skip to main content

Magento 2 - event observer called multiple time

I am using sales_order_status_history_save_after event for store data in my custom table.

I need also update comment with a prefix of commentId (entity_id) in to sales_order_status_history table.

While I am doing setComment data in observer than two times data stored in my custom table.

also, I have added log in to the observer file I found that my event call two times. I did not understand why its call two times and my data stored 2 times in my custom table.

is anyone knows how we can solve this issue??