Explorar el Código

Remove the read locking, I don't think Each() implementers treat it as read only.

Matt Bolt hace 4 años
padre
commit
26185fa2ca
Se han modificado 1 ficheros con 0 adiciones y 6 borrados
  1. 0 6
      pkg/kubecost/allocation.go

+ 0 - 6
pkg/kubecost/allocation.go

@@ -1691,16 +1691,10 @@ func (as *AllocationSet) Delete(name string) {
 
 // Each invokes the given function for each Allocation in the set
 func (as *AllocationSet) Each(f func(string, *Allocation)) {
-	as.RLock()
-	defer as.RUnlock()
-
 	if as == nil {
 		return
 	}
 
-	// note: if we find that f() is causing heavy contention and blocking
-	// note: writes, we can hold a read lock while we copy the allocations,
-	// note: then execute the each over the copied map
 	for k, a := range as.allocations {
 		f(k, a)
 	}