Skip to content

Commit

Permalink
Allow termination under execution because of reentrancy in tests.
Browse files Browse the repository at this point in the history
Callback can be executed synchronously inside `send`
  • Loading branch information
Iliya-usov committed Oct 19, 2023
1 parent 1c4c9c7 commit d229513
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class RdCall<TReq, TRes>(internal val requestSzr: ISerializer<TReq> = Polymorphi
val task = CallSiteWiredRdTask(intersectedDef.lifetime, this, taskId, scheduler ?: proto.scheduler)
task.result.advise(intersectedDef.lifetime) {
if (it !is RdTaskResult.Success || !it.value.isBindable()) {
intersectedDef.terminate()
intersectedDef.terminate(true)
}
}
intersectedDef.lifetime.executeIfAlive {
Expand Down
3 changes: 3 additions & 0 deletions rd-net/RdFramework/Tasks/RdCall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ private IRdTask<TRes> StartInternal(Lifetime requestLifetime, TReq request, ISch
task.Result.Advise(intersectedDef.Lifetime, result =>
{
if (result.Status != RdTaskStatus.Success || !result.Result.IsBindable())
{
intersectedDef.AllowTerminationUnderExecution = true;
intersectedDef.Terminate();
}
});

using var cookie = intersectedDef.UsingExecuteIfAlive();
Expand Down

0 comments on commit d229513

Please sign in to comment.