This commit adds the following changes to router package:
* it refactors Advertise() function which now does only what
it claims to do: advertising
* various router packages functions/methods have been renamed to make
their functionality more obvious and more in line with what they actually do
* function documentation changes related to the above bullet points
Addressing the comments in #591, router.String() now returns "default"
Furthermore, a tonne of other renaming has been included in this commit
as a result of running go vet ./... inside the router package.
This commit adds the following changes:
* advert now stores a list of route events as opposed to just last one
* attempt to dedup route events before appending them to advert
* have max suppress threshold for long time suppressed adverts
* decaying events on every advert tick
Originally we werent decaying penalties on every advert tick.
That was incorrect behaviour. Furthermore some events would end up being
accumulated potentially causing memory leaks.
We were also overriding the last received router event which was causing
incorrect sequence of events to be applied when received by a receiver:
Create, Delete would be "squashed" into Delete only which would be
nonsensical since the Create event would never be delivered hence we
would be deleting nonexistent routes.
Not Decaying the events on every tick or not having the max suppression
threshold could lead to DoS by growing the router memory infinitely.
* fix race with rand.Intn for non default source
* increase random interval to avoid issues when many services
running on the host
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
mutex locking have errors, so when two service (one pub, other sub)
try to use this broker it waits for mutex release and nothing works
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>