Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

fix(least-conn) change cleanup order #126

Merged
merged 1 commit into from Mar 19, 2021
Merged

fix(least-conn) change cleanup order #126

merged 1 commit into from Mar 19, 2021

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Mar 16, 2021

remove address from binary heap upon 'disabling' instead of when
'deleting'. Seems safer to prevent race conditions. This means that in between disabling and deleting the address can no longer be selected by GetPeer.

@Tieske Tieske requested review from a user and locao March 16, 2021 22:34
@Tieske
Copy link
Member Author

Tieske commented Mar 16, 2021

Removing an address is a 3 step process;

  1. it gets disabled (weight = 0)
  2. balancer algorithm is updated (depending on balancer type is can update its internal structures)
  3. the address gets actually deleted

Now getPeer selects an address from the binary heap maintained by the balancer. That heap was updated in step 3, with this change it is updated in step 1 (removing the address). This seems safer.

remove address from binary heap upon 'disabling' instead of when
'deleting'.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants