DaWesen commented on code in PR #3695:
URL: https://github.com/apache/dubbo-go/pull/3695#discussion_r3841330129


##########
filter/adaptivesvc/limiter/hill_climbing.go:
##########
@@ -50,6 +47,72 @@ var (
        stablePeriod  = 32000 * time.Millisecond
 )
 
+// The standard library does not provide atomic types for float64,
+// time.Duration and time.Time. The following minimal wrappers keep the
+// HillClimbing limiter on top of sync/atomic primitives only.
+type atomicFloat64 struct {
+       bits atomic.Uint64
+}
+
+func newAtomicFloat64(v float64) *atomicFloat64 {
+       f := &atomicFloat64{}
+       f.bits.Store(math.Float64bits(v))
+       return f
+}
+
+func (f *atomicFloat64) Load() float64 {
+       return math.Float64frombits(f.bits.Load())
+}
+
+func (f *atomicFloat64) Store(v float64) {
+       f.bits.Store(math.Float64bits(v))
+}
+
+type atomicDuration struct {
+       nanos atomic.Int64
+}

Review Comment:
   已采用此方案



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to