mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
move all variables in sampleAndWaterMarkHistograms::innerSet
to tiptoe around https://github.com/golang/go/issues/43570 for #97685
This commit is contained in:
parent
b959f01c5a
commit
611184aa59
@ -160,17 +160,14 @@ func (saw *sampleAndWaterMarkHistograms) SetX1(x1 float64) {
|
||||
}
|
||||
|
||||
func (saw *sampleAndWaterMarkHistograms) innerSet(updateXOrX1 func()) {
|
||||
var when time.Time
|
||||
var whenInt int64
|
||||
var acc sampleAndWaterMarkAccumulator
|
||||
var wellOrdered bool
|
||||
func() {
|
||||
when, whenInt, acc, wellOrdered := func() (time.Time, int64, sampleAndWaterMarkAccumulator, bool) {
|
||||
saw.Lock()
|
||||
defer saw.Unlock()
|
||||
when = saw.clock.Now()
|
||||
whenInt = saw.quantize(when)
|
||||
acc = saw.sampleAndWaterMarkAccumulator
|
||||
wellOrdered = !when.Before(acc.lastSet)
|
||||
// Moved these variables here to tiptoe around https://github.com/golang/go/issues/43570 for #97685
|
||||
when := saw.clock.Now()
|
||||
whenInt := saw.quantize(when)
|
||||
acc := saw.sampleAndWaterMarkAccumulator
|
||||
wellOrdered := !when.Before(acc.lastSet)
|
||||
updateXOrX1()
|
||||
saw.relX = saw.x / saw.x1
|
||||
if wellOrdered {
|
||||
@ -195,6 +192,7 @@ func (saw *sampleAndWaterMarkHistograms) innerSet(updateXOrX1 func()) {
|
||||
} else if saw.relX > saw.hiRelX {
|
||||
saw.hiRelX = saw.relX
|
||||
}
|
||||
return when, whenInt, acc, wellOrdered
|
||||
}()
|
||||
if !wellOrdered {
|
||||
lastSetS := acc.lastSet.String()
|
||||
|
Loading…
Reference in New Issue
Block a user