question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cancel all tasks in login flow

See original GitHub issue

I have this saga:

function* authorizedFlow() {
  let payload
  while (({payload} = yield take(actions.LOGIN_SUCCESS))) {
    const { access_token } = payload
    yield race({
      watchers: yield [
        call(refreshUser, access_token),
        call(refreshActivities, access_token),
        call(refreshPendingTransactions, access_token)
      ],
      logout: yield take(actions.LOGOUT_SUCCESS)
    })
    console.info("authorizedFlow: Logged out")
  }
}

I would like to cancel all the watchers when the LOGOUT_SUCCESS action was sent. The cancel method does not seem to accept an array of tasks. Whats the most elegant way to cancel those watchers. Is that flow a good pattern anyway? Of course each watcher could race against the LOGOUT_SUCCESS itself but I’d like to keep them clean.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
yelouaficommented, Apr 19, 2016

@pke Ok I missed your first example. Inside race, you shouldn’t yield effects just specify them

yield race({
      watchers: /*yield*/ [
        call(refreshUser, access_token),
        call(refreshActivities, access_token),
        call(refreshPendingTransactions, access_token)
      ],
      logout: /*yield*/ take(actions.LOGOUT_SUCCESS)
    })
0reactions
yelouaficommented, Apr 27, 2016

closing this. ESlint rules is tracked in #179

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cancelling all tasks when a new one is created - Stack Overflow
I am trying to cancel any task that are running when a user changes their selection and start a new task . I...
Read more >
Flow to delete Open Tasks when opportunity is stage = Archived
What I need to do is if an opportunity is marked as Stage = "Archived" i need a flow to check if there...
Read more >
Cancel all running flow runs for a flow in an environment
Do you want to automate the cancellation of running Power Automate flow runs? Microsoft 365 CLI cmdlets will help you to cancel all...
Read more >
How do I cancel "In Progress" tasks - Okta Support
I assume one way is to turn off the flow, copy it, and then move on from the copied flow. That would at...
Read more >
5 Ways to Stop a Flow in Power Automate
The Cancel Flow Run action requires you to input three values. ... Unfortunately, there is no way to list all the Run IDs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found