Chore: remove unused atomic.Bool + doc

This commit is contained in:
kayos@tcp.direct 2024-01-20 05:03:29 -08:00
förälder fa40018d6b
incheckning c1ed13396b
Signerad av: kayos
GPG-nyckel ID: 4B841471B4BEE979

Visa fil

@ -34,7 +34,6 @@ type atomics struct {
stop *sync.Once
birth *atomic.Pointer[time.Time]
duration *atomic.Pointer[time.Duration]
slow *atomic.Bool
}
func newAtomics() atomics {
@ -45,7 +44,6 @@ func newAtomics() atomics {
stop: new(sync.Once),
birth: new(atomic.Pointer[time.Time]),
duration: new(atomic.Pointer[time.Duration]),
slow: new(atomic.Bool),
}
manhattan.birth.Store(&time.Time{})
manhattan.closed.Store(false)
@ -198,11 +196,12 @@ func (s *Speedometer) slowDown() error {
//
}
s.internal.slow.Store(true)
// the slowing will continue until morale improves
// (sleep until our overall rate re-enters acceptable threshhold)
for s.Rate() > float64(s.speedLimit.Burst)/s.speedLimit.Frame.Seconds() {
time.Sleep(s.speedLimit.Delay)
}
s.internal.slow.Store(false)
return nil
}