Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RxCommand ignores call when another call is still in progress #38

Closed
fedotxxl opened this issue Apr 18, 2020 · 1 comment
Closed

RxCommand ignores call when another call is still in progress #38

fedotxxl opened this issue Apr 18, 2020 · 1 comment

Comments

@fedotxxl
Copy link

Here is a code to reproduce:

  var command = RxCommand.createAsync<int, int>((delay) => Future.delayed(Duration(seconds: delay)).then((_) => delay));
  command.listen((r) {
    print(r);
  });

  command.call(2);
  command.call(5);

It's a little bit strange to me. How should I organize code in this case? What was the reason for this behavior? Isn't it better to interrupt the first call (with notification to call action) and start processing the second one... and ignore the first one result?

@escamoteur
Copy link
Collaborator

this is actually how it is meant to be. Interrupting an async function isn't possible you would need to pass a cancellation token and the async function would have to check that periodically.

Perhaps @anaisbetts has an idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants