What I did to solve the problem was to compare the value of the updated_atobject $observerwith the current time. If the last update was more than 3 seconds ago (a completely arbitrary value), I allow the observer to complete, otherwise I will return. This worked for me, because two instances of my observer always worked for 1-2 seconds.
I understand that this is not the best solution, since it does not take into account the load on the server or other problems with the delay, so if someone could think of a better solution, I would appreciate feedback.
$updatedAt = date('U', strtotime($observer->getQuote()->getUpdatedAt()));
$now = time();
if(($updatedAt + 3) > $now){
return $this;
}
.... execute observer code
source
share