bezzad / ErrorControlSystem

ErrorControlSystem is a .NET library created to automate handling .NET Windows-Base application exceptions and raise that to a sql server. This exception handler have some features as screen capturing, fetch server date time in exception occurrence time and etc.
http://bezzad.github.io/ErrorControlSystem/
GNU General Public License v3.0
32 stars 14 forks source link

DataFlow Blocks is not work always! #8

Closed bezzad closed 9 years ago

bezzad commented 9 years ago

When DataFlow Blocks get to Faulted state, another post massage not work!

My some action blocks when doing some actions , maybe that actions not work actually, so the acrtion block also get to Faulted state and not work for another queue incoming objects...

bezzad commented 9 years ago

Before do post action, check the block state is not equals by TaskStatus.Faulted , either not, so create that again.

if (abErrorSaver == null || abErrorSaver.Completion.IsFaulted)
{
     abErrorSaver = new ActionBlock<Error>(async e =>
                 { 
                          ... some action codes ...  
                 }, new ExecutionDataflowBlockOptions { MaxMessagesPerTask = 1 });
}

await abErrorSaver.SendAsync(error);