reverse_proxy: Implement active health checks

This commit is contained in:
Matthew Holt 2019-09-03 12:10:11 -06:00
parent 026df7c5cb
commit ccfb12347b
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
3 changed files with 309 additions and 74 deletions

View file

@ -80,6 +80,14 @@ func (up *UsagePool) LoadOrStore(key, val interface{}) (actual interface{}, load
return
}
// Range iterates the pool the same way sync.Map.Range does.
// This does not affect usage counts.
func (up *UsagePool) Range(f func(key, value interface{}) bool) {
up.pool.Range(func(key, value interface{}) bool {
return f(key, value.(*usagePoolVal).value)
})
}
type usagePoolVal struct {
usage int32 // accessed atomically; must be 64-bit aligned for 32-bit systems
value interface{}