Unfreeze operators as soon as possible due to peers' expirations #581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unfreeze operators when the blocking peers (other operators of the same "peering neighbourhood") are supposed to expire, not when the next keepalive happens as it was before.
This will reduce the waiting time for up to 60 seconds to much lower delay. However, delays of 60 seconds are still possible but less probable: if the blocking operators have sent their keepalives moments before exiting, they will be believed to exist for the next 60 second.
Besides, add a little jitter to the peering keepalives, so that they would distribute evenly after some time of functioning. There is already such an implicit jitter — the
PATCH
operation with varying duration (due to its networking nature). But it is not controllable, and the distribution in time happens slowly. With multiple namespaces served (each with its own peering keepalive), it would be better to distribute them faster to reduce the peak load on the K8s API.And also some code cleanups: improve reprs of peers for readability; remove the constructor types that are not needed anymore (peers are used only internally, and we do not feed
timedelta
/datetime
into them).This is an extraction of needed, useful, but unrelated changes from a bigger PR.