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

Inconsistency w.r.t Task#executeOn() documentation #107

Open
maesenka opened this issue Jul 30, 2020 · 1 comment
Open

Inconsistency w.r.t Task#executeOn() documentation #107

maesenka opened this issue Jul 30, 2020 · 1 comment

Comments

@maesenka
Copy link

When try out the code on https://github.com/monix/monix.io/blame/master/_docs/3x/eval/task.md#L599-L639 I see no difference between the two case with or without the asyncBoundary call.

In other words, it seems that now only the forked Task runs in the Scheduler.io() and the onFinish reverts to a thread from the default Scheduler.

Here's what I'm seeing in Ammonite:

@ val cancelable = {
    source.flatMap(_ => forked)
      .doOnFinish(_ => onFinish)
      .runToFuture
  }
Running on thread: main
Running on thread: my-io-592
Ends on thread: scala-execution-context-global-485
cancelable: monix.execution.CancelableFuture[Unit] = Async(Future(Success(())), monix.eval.internal.TaskConnection$Impl$$anon$1@1a799c73)

 @ val cancelable = {
    source.flatMap(_ => forked)
      .asyncBoundary
      .doOnFinish(_ => onFinish)
      .runToFuture
  }
Running on thread: main
Running on thread: my-io-592
Ends on thread: scala-execution-context-global-485
cancelable: monix.execution.CancelableFuture[Unit] = Async(Future(<not completed>), monix.eval.internal.TaskConnection$Impl$$anon$1@2d3c799e)


Is there something I'm missing? Or has there been a change in behavior since this was written?

@Avasil
Copy link
Collaborator

Avasil commented Jul 31, 2020

executeOn returns to the previously default scheduler so asyncBoundary is redundant.
Looks like the docs weren't updated - thank you for bringing it up :)

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