# Infinite onPostSave Loop

**URL:** <https://forum.mautic.org/t/infinite-onpostsave-loop/13131>\
**Category:** Development\
**Created:** [February 27, 2020, 2:12pm UTC](https://forum.mautic.org/t/infinite-onpostsave-loop/13131 "2020-02-27T14:12:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mautist](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mautist/32/1761_2.png) [@Mautist](https://forum.mautic.org/u/Mautist)\
**Post date:** [February 27, 2020, 2:12pm UTC](https://forum.mautic.org/t/infinite-onpostsave-loop/13131/1 "2020-02-27T14:12:04Z")

</div>

Hi all =)  
Is it possible in an “onLeadPostSave”, where i update several Lead fields and save that lead entity, to prevent fire that function again? It causes an infinite loop.

---

<div class="post-metadata">

**Author:** ![Cezar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/cezar/32/5152_2.png) [@Cezar](https://forum.mautic.org/u/Cezar)\
**Post date:** [May 10, 2021, 11:47am UTC](https://forum.mautic.org/t/infinite-onpostsave-loop/13131/2 "2021-05-10T11:47:33Z")

</div>

Here you have an example on how to prevent the infinite event loop  
app/bundles/LeadBundle/EventListener/LeadSubscriber.php:138

I’m using Mautic 3.3.1
