bastion-rs / bastion

Highly-available Distributed Fault-tolerant Runtime
https://www.bastion-rs.com
Apache License 2.0
2.78k stars 101 forks source link

Don't remove a distributor from the global dispatcher if it has clients #330

Closed cjfuller closed 3 years ago

cjfuller commented 3 years ago

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
cjfuller commented 3 years ago
o0Ignition0o commented 3 years ago

Thanks a lot, let's merge this!