mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-06 17:40:57 +00:00
Use generics for waitFor (delaying workqueue) in client-go
With this change, we can typically avoid an extra heap allocation when calling AddAfter with a positive duration (which causes the creation of a waitFor object). This is because workqueues are typically used with string keys, and casting a string (or more generally, non-pointer types) to an `interface{}` will cause an heap escape / allocation. Ater this change, there is no longer any usage of `type t interface{}`, which was creating some confusion after the switch to generics in the workqueue package. Co-authored-by: Quan Tian <quan.tian@broadcom.com> Signed-off-by: Antonin Bas <antonin.bas@broadcom.com> Kubernetes-commit: 53ddffb55709857fec6bddbd5ca4ca1b03f7da97
This commit is contained in:
committed by
Kubernetes Publisher
parent
ba20fcad8f
commit
3c28f81659
@@ -212,7 +212,6 @@ type Typed[t comparable] struct {
|
||||
}
|
||||
|
||||
type empty struct{}
|
||||
type t interface{}
|
||||
type set[t comparable] map[t]empty
|
||||
|
||||
func (s set[t]) has(item t) bool {
|
||||
|
Reference in New Issue
Block a user