# Workflow Pause/Terminate

**URL:** <https://community.weweb.io/t/workflow-pause-terminate/1613>\
**Category:** How do I?\
**Created:** [December 16, 2022, 7:13pm UTC](https://community.weweb.io/t/workflow-pause-terminate/1613 "2022-12-16T19:13:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marquis](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/marquis/32/12422_2.png) [@Marquis](https://community.weweb.io/u/Marquis)\
**Post date:** [December 16, 2022, 7:13pm UTC](https://community.weweb.io/t/workflow-pause-terminate/1613/1 "2022-12-16T19:13:37Z")

</div>

Wondering if anyone could help me understand the steps required to create buttons that 1-pause and 2-terminate a workflow that is running.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [December 19, 2022, 11:49am UTC](https://community.weweb.io/t/workflow-pause-terminate/1613/2 "2022-12-19T11:49:17Z")

</div>

Usually workflows are only triggered. If you have a “long” workflow (maybe you are using a long time delay) you can add “pass through a condition” between actions to check for a variable, then other workflows can modify that variable to make the condition fail.

Probably there is a better way to achieve what you want. Can you share some details about your workflow and what are you trying to accomplish?

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [October 28, 2023, 6:39am UTC](https://community.weweb.io/t/workflow-pause-terminate/1613/3 "2023-10-28T06:39:58Z")

</div>

@dorilama Are you saying that a workflow could somehow cancel an active time delay in another workflow? Can you elaborate please?

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [October 28, 2023, 3:53pm UTC](https://community.weweb.io/t/workflow-pause-terminate/1613/4 "2023-10-28T15:53:15Z")

</div>

the nocode time delay action can’t be canceled. If you need to create your own cancelable timers you need to use js with [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) or [setInterval](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) and their correspondent clear functions, and trigger workflows (`wwLib.executeWorkflow`) from the callbacks.  
There is a [post by Aurelie](https://community.weweb.io/t/loop-until-condition-is-met/1564/5) about something like this.  
It’s very easy to create infinite loops or multiple instances of the timeout because of multiple executions that don’t clear the previous instance, so be aware of this and check your implementation.

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [October 28, 2023, 4:07pm UTC](https://community.weweb.io/t/workflow-pause-terminate/1613/5 "2023-10-28T16:07:13Z")

</div>

Thanks @dorilama. I’m asking this in the context of trying to create an auto-logout feature after a certain amount of time. Have you created something like that in WeWeb?

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [October 28, 2023, 5:45pm UTC](https://community.weweb.io/t/workflow-pause-terminate/1613/6 "2023-10-28T17:45:39Z")

</div>

relying on a timer to auto logout is not the best approach. For example think about an use that will just close the browser, your auto-logout workflow will never execute. A better way is to set a shorter token expiration for auth and then either auto refresh the toke at intervals or send the user to login when a request is made and the token is expired.  
Xano doesn’t support refresh tokens. There are topics about implementing it on their forum.  
Supabase handles refresh tokens and has utility functions specifically for this.

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [October 28, 2023, 6:28pm UTC](https://community.weweb.io/t/workflow-pause-terminate/1613/7 "2023-10-28T18:28:36Z")

</div>

Sounds good thanks @dorilama!
