Because distributors are usable globally by name, it's possible (and
useful) for multiple groups of children to use the same distributor.
However, if one of the groups of children is then stopped as part of the
normal flow of an application, the distributor is removed from the
global dispatcher, and all senders receive an error on trying to send to
that distributor, even if it still has active recipients from other
groups of children.
This commit changes remove_distributor in the global dispatcher so
that it checks to see if it still has recipients and only removes the
distributor if there are no remaining recipients.
Because distributors are usable globally by name, it's possible (and useful) for multiple groups of children to use the same distributor. However, if one of the groups of children is then stopped as part of the normal flow of an application, the distributor is removed from the global dispatcher, and all senders receive an error on trying to send to that distributor, even if it still has active recipients from other groups of children.
This commit changes
remove_distributor
in the global dispatcher so that it checks to see if it still has recipients and only removes the distributor if there are no remaining recipients.Checklist
cargo test
.