mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +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()) {
|
func (saw *sampleAndWaterMarkHistograms) innerSet(updateXOrX1 func()) {
|
||||||
var when time.Time
|
when, whenInt, acc, wellOrdered := func() (time.Time, int64, sampleAndWaterMarkAccumulator, bool) {
|
||||||
var whenInt int64
|
|
||||||
var acc sampleAndWaterMarkAccumulator
|
|
||||||
var wellOrdered bool
|
|
||||||
func() {
|
|
||||||
saw.Lock()
|
saw.Lock()
|
||||||
defer saw.Unlock()
|
defer saw.Unlock()
|
||||||
when = saw.clock.Now()
|
// Moved these variables here to tiptoe around https://github.com/golang/go/issues/43570 for #97685
|
||||||
whenInt = saw.quantize(when)
|
when := saw.clock.Now()
|
||||||
acc = saw.sampleAndWaterMarkAccumulator
|
whenInt := saw.quantize(when)
|
||||||
wellOrdered = !when.Before(acc.lastSet)
|
acc := saw.sampleAndWaterMarkAccumulator
|
||||||
|
wellOrdered := !when.Before(acc.lastSet)
|
||||||
updateXOrX1()
|
updateXOrX1()
|
||||||
saw.relX = saw.x / saw.x1
|
saw.relX = saw.x / saw.x1
|
||||||
if wellOrdered {
|
if wellOrdered {
|
||||||
@ -195,6 +192,7 @@ func (saw *sampleAndWaterMarkHistograms) innerSet(updateXOrX1 func()) {
|
|||||||
} else if saw.relX > saw.hiRelX {
|
} else if saw.relX > saw.hiRelX {
|
||||||
saw.hiRelX = saw.relX
|
saw.hiRelX = saw.relX
|
||||||
}
|
}
|
||||||
|
return when, whenInt, acc, wellOrdered
|
||||||
}()
|
}()
|
||||||
if !wellOrdered {
|
if !wellOrdered {
|
||||||
lastSetS := acc.lastSet.String()
|
lastSetS := acc.lastSet.String()
|
||||||
|
Loading…
Reference in New Issue
Block a user