MCPcopy Create free account
hub / github.com/Permify/permify / GetAverageLoad

Method GetAverageLoad

pkg/consistent/consistent.go:149–156  ·  view source on GitHub ↗

GetAverageLoad calculates and returns the current average load across all members. It is a public method that provides thread-safe access to the load calculation.

()

Source from the content-addressed store, hash-verified

147// GetAverageLoad calculates and returns the current average load across all members.
148// It is a public method that provides thread-safe access to the load calculation.
149func (c *Consistent) GetAverageLoad() float64 {
150 // Acquire a read lock to ensure thread-safe access to shared resources.
151 c.mu.RLock()
152 defer c.mu.RUnlock()
153
154 // Delegate the actual load calculation to the internal helper method.
155 return c.calculateAverageLoad()
156}
157
158// calculateAverageLoad is a private helper method that performs the actual calculation
159// of the average load across all members. It is not thread-safe and should be called

Callers 1

consistent_test.goFile · 0.80

Calls 1

calculateAverageLoadMethod · 0.95

Tested by

no test coverage detected