File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -125,24 +125,22 @@ await process(state, t.Item1)
125125 . ContinueWith ( task =>
126126 {
127127 if ( task . Status == TaskStatus . Faulted )
128- t . Item2 . SetException ( task . Exception ) ;
128+ t . Item2 . SetException ( task . Exception ?? new Exception ( "Task failed" ) ) ;
129129 else
130130 {
131131 state = task . Result . Item1 ;
132132 t . Item2 . SetResult ( task . Result . Item2 ) ;
133133 }
134- } )
134+ } , TaskContinuationOptions . RunContinuationsAsynchronously )
135135 . ConfigureAwait ( false ) ;
136136 } , new ExecutionDataflowBlockOptions { CancellationToken = cancellationToken } ) ;
137137 }
138138
139139 public Task < TReply > Tell ( TMsg message )
140140 {
141- var tcs = new TaskCompletionSource < TReply > ( ) ;
141+ var tcs = new TaskCompletionSource < TReply > ( TaskContinuationOptions . RunContinuationsAsynchronously ) ;
142142 _actionBlock . Post ( ( message , tcs ) ) ;
143143
144- // this will help to relax the task scheduler, for some reason the task may block if directly returned
145- tcs . Task . Wait ( _cancellationToken ) ;
146144 return tcs . Task ;
147145 }
148146 }
You can’t perform that action at this time.
0 commit comments