# Advanced flow: concurrency limit on a flow

**URL:** <https://community.homey.app/t/advanced-flow-concurrency-limit-on-a-flow/69979>\
**Category:** Flows\
**Tags:** advancedflow\
**Created:** [October 6, 2022, 12:40pm UTC](https://community.homey.app/t/advanced-flow-concurrency-limit-on-a-flow/69979 "2022-10-06T12:40:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaccoH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jaccoh/32/33966_2.png) [@JaccoH](https://community.homey.app/u/JaccoH)\
**Post date:** [October 6, 2022, 12:40pm UTC](https://community.homey.app/t/advanced-flow-concurrency-limit-on-a-flow/69979/1 "2022-10-06T12:40:09Z")

</div>

So basically I created an advanced flow to automatically close the gate after about 90 seconds after it has been opened. That sounds really simple but it isn’t.

One obvious issue is: I do not have a concrete trigger other then checking every 10 seconds if the gate is open or not after which we start an advanced flow with timers etc. In this case I need to be sure that only one instance of this flow is running at a time. I do this with a boolean right now.

But is there a more simple way to limit the concurrency or do “locking mechanisms”?

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [October 6, 2022, 3:21pm UTC](https://community.homey.app/t/advanced-flow-concurrency-limit-on-a-flow/69979/2 "2022-10-06T15:21:37Z")

</div>

Maybe, your problem is clearer, when you share the Flows, you made.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 6, 2022, 3:31pm UTC](https://community.homey.app/t/advanced-flow-concurrency-limit-on-a-flow/69979/3 "2022-10-06T15:31:57Z")

</div>

Check the [Advanced Triggers](https://homey.app/a/nl.qluster-it.AdvancedTriggers/) app  
It can (re)start a flow with several smart options  
Example flow:

> [@The Flow Exchange(r) - Exchange Your Flows with Others!](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981/11):
>
> Debounce Example This is a ready to use example of how to use the debounce function of [Advanced Triggers](https://homey.app/nl-nl/app/nl.qluster-it.AdvancedTriggers/Advanced-Triggers/). I used Simple LOG to write into a log, but you can replace that off course. Apps used: [Advanced Triggers](https://homey.app/nl-nl/app/nl.qluster-it.AdvancedTriggers/Advanced-Triggers/)[Simple LOG](https://homey.app/nl-nl/app/nl.nielsdeklerk.log/Simple-LOG/) TEF: H4sIAAAAAAACA91WWYvcRhD+K0JPCWybvg+9GRJCnuO3ZVmqu6t3hDXSRqOxvZj97ylpjmTHs4kw2OA8CZVKdXxfXZ/rqW4+13335s9uv5twZO305m3+AH3C/G5sHx5w3C0adVOf5NX5w/PzTQ11c/u5bum7Ujqp7JBxEQPT3AUGwD0rKI1y0oSsU32zmPoF47AnW9Wvn2D72CGJsW6mcY83dZr95ZJ0ceBZMBmYjjYw77xkJMpJZ…
