Skip to content

Commit

Permalink
add doc to selection reasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
aratz-lasa committed May 20, 2023
1 parent bcb9af7 commit 2c50d90
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions virtual/registry/kv_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ func pickServersForActivation(
panic("[invariant violated] pickServerForActivation should not be called with empty slice")
}

// These variables are initialized as boolean values to indicate if the selection
// is derived from the cache (fromCache) or from heartbeat messages (fromHeartbeat).
var (
fromCache, fromHeartbeat bool
)
Expand Down Expand Up @@ -842,6 +844,8 @@ func minMaxMemUsage(available []serverState) (serverState, serverState) {
return minMemUsage, maxMemUsage
}

// selectionReason determines the reason for the server selection based on the provided flags.
// It returns a string indicating whether the selection is from cache, heartbeat, both, or none.
func selectionReason(fromCache bool, fromHeartbeat bool) string {
if fromCache && fromHeartbeat {
return "from_client_cache_and_heartbeat"
Expand Down

0 comments on commit 2c50d90

Please sign in to comment.