Closed tjaskula closed 5 years ago
@tjaskula Can you indicate where the Thread.Sleep() uses are? There may be a few in tests, which is not the greatest choice, and will inevitably fail. However, there should pretty much never be Thread.Sleep() in the library code. I think there may be one possible use of Thread.Sleep() when the World is terminating. I don't remember. In such case it could still be replaced with a better construct as you suggest.
Except tests there are actualy two places in:
@tjaskula Yes, thanks for the reminder. I would be perfectly happy if both of these Sleep()
uses went away. Eventually Stop()
will be async in that the Sweep()
will be actor-based and return immediately. At that point we will need an atomic indicator that Sweep()
and Stop()
have fully completed, and we will need to aggregate that indicator into a single one when stopping multiple Stage
containers. (The default container is always created, but the application/service can start any number of others.)
I’ll take care of that
Backoff
is addressed in #29
@zpbappi @VaughnVernon Why we need that when stopping a stage in Stage.Stop()
:
while (Count > 1 && ++retries < 10)
{
try { Thread.Sleep(10); } catch (Exception) { }
}
This is not more relevant
There are many calls to
Thread.Sleep
which is not the best alternative in concurrent code.