Conversation
|
Have you tried using cancel tokens for this? It would completely eliminate the need to account for weird receiver behavior |
Cancel token is used to initiate graceful shutdown. Problem with it is that it's a one-time thing (which makes sense for graceful-shutdown), while circuit-breaker should be able to send the reset signal multiple times. |
But |
canceller stops everything (e.g. metrics server). resetter only proxies. |
Sorry I wasn't being too descriptive. Cancel tokens only stop the tasks that listen to them. So you should create separate tokens and reset tasks for each proxy you're running, since they should be able to reset independently. If you just want to keep on reset task for now that's fine too. To tie it to the other cancel token for the shutdown you can use the and in |
reset signal channels didn't check for errors on receive, and would only stop the subproxy if receive was
Ok. however, it's possible that receiver lags, in which case.recv()would yieldErr, which would cause the resetter task to exit w/o stopping the web-service.consequently, this can cause one of the sub-proxies to remain active, while 2 others would stop, and the whole proxy would endlessly wait in the
join_all.this PR fixes above condition, improves error handling in general, and adds basic unit test.