akka.net icon indicating copy to clipboard operation
akka.net copied to clipboard

Hide task scheduler

Open Zetanova opened this issue 2 years ago • 0 comments

Fixes # Leaking the ActorCell Task Scheduler to the async execution.

Changes

TaskSchedulerExecutor will schedule work with the Task.CreationOptions.HideScheduler flag set. The executor is used by the default-executor and channel-executor

This will prevent mistakenly leaking the used ActorCell TaskScheduler to EF-Core or other frameworks

This will make following both statements equal (the are currently not equal):

bool Receive(object message) {
    //statement 1
    Task.Run(MyTaskAsync()).PipeTo(Self);

   //statement 2
   MyTaskAsync().PipeTo(Self);

   async Task<object> MyTaskAsync() {
        //demo async process
        return "done";
   }
}

Checklist

Zetanova avatar Jan 26 '24 18:01 Zetanova