I have an issue when BlockingCollection<MyItem>
is taking too much time to wake up from .Take()
call.
The scenario is this:
I have a thread that pushing data to BlockingCollection
very fast (actually in XUnit i did a for
loop. I have a 3 Task
that just sitting in .Take()
call and waiting to items to be added. From output I can see that almost 200 items (up to 1 second or more) was added to collection before the first Task
wake up and actually collect data from BlockingCollection
.
I have multiple "buffers" based on BlockingCollection
organized in pipe-line fashion and all of them suffer from too-much-time-waking on .Take()
action.
I tried .TryTake()
and .GetConsumingEnumerable()
with the same results.
The idea that in the end of this pipeline I have a one threaded, slow function that process items one by one and it could take unknown time to process single item. I just need to make sure that 'item' passed from "buffer" to "buffer" very fast (as soon as it get inserted in the first "buffer")
I just need to make sure that start-up time (in .Take()
or .TryTake()
etc..) will happen close to time when item added to collection