Skip to content

Commit

Permalink
Merge pull request #843 from rogeralsing/async-await-resume-mailbox-h…
Browse files Browse the repository at this point in the history
…otfix

Hotfix async await when awaiting IO completion port based tasks
  • Loading branch information
rogeralsing committed Apr 13, 2015
2 parents dbf84d8 + 386ed86 commit 10b8fd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/Akka.Tests/Dispatch/AsyncAwaitSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ class AsyncActor : ReceiveActor
{
public AsyncActor()
{
Receive<string>(AsyncBehavior.Suspend, async s =>
Receive<string>( async s =>
{
await Task.Yield();
await Task.Delay(TimeSpan.FromMilliseconds(100));
if (s == "stop")
{
Sender.Tell("done");
Expand Down Expand Up @@ -345,7 +346,7 @@ public async Task Actor_should_be_able_to_resume_suspend()
asker.Tell("msg #" + i);
}

var res = await asker.Ask<string>("stop", TimeSpan.FromSeconds(55555));
var res = await asker.Ask<string>("stop", TimeSpan.FromSeconds(5));
res.ShouldBe("done");
}
}
Expand Down
1 change: 1 addition & 0 deletions src/core/Akka/Dispatch/ActorTaskScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ protected override void QueueTask(Task task)

s.Self.Tell(new CompleteTask(s, () =>
{
SetCurrentState(s.Self,s.Sender,s.Message);
TryExecuteTask(task);
if (task.IsFaulted)
Rethrow(task, null);
Expand Down

0 comments on commit 10b8fd7

Please sign in to comment.