TPL Dataflow block has .InputCount
and .OutputCount
properties. But it can perform execution over item right now, and there is no property like .Busy [Boolean]
. So is there a way to know if block is now operating and one of item still there?
UPDATE:
Let me explain my issue. Here on pic is my current Dataflow network scheme.
BufferBlock
holds URLs to load, number of TransformBlock
s load pages through proxy servers and ActionBlock
at the end performs work with loaded pages. TransformBlock
s has predefined .BoundedCapacity
, so BufferBlock
waits for any of TransformBlocks
becomes free and then post item into it.
Initially I post all URLs to Buffer Block
. Also if one of TransformBlock
s throw exception during loading HTML, it returns it's URL back to BufferBlock
. So my goal is somehow wait until all of my URLs was guarantee loaded and parsed. For now I'm waiting like this:
Do While _BufferBlock.Count > 0 Or _
GetLoadBlocksTotalInputOutputCount(_TransformBlocks) > 0 Or _
_ActionBlock.InputCount > 0
Await Task.Delay(1000)
Loop
Then I call TransformBlock.Complete
on all of them. But in this case, there still can be last URLs loading it TransformBlock
s. If last URL was not successfully loaded, it becomes 'lost', because none of TransformBlocks wouldn't take it back. That's why I want to know if TransformBlock
s are still operating. Sorry my bad English.