fix(gateway): synchronize qualification stage evidence
This commit is contained in:
@@ -125,6 +125,7 @@ type fairPacer struct {
|
||||
mu sync.Mutex
|
||||
bytesPerSecond int64
|
||||
flows map[string]fairPacerFlow
|
||||
reservations atomic.Uint64
|
||||
}
|
||||
|
||||
type fairPacerFlow struct {
|
||||
@@ -194,6 +195,7 @@ func (p *fairPacer) reserveAt(now time.Time, flow string, bytes int) time.Time {
|
||||
|
||||
func (p *fairPacer) wait(ctx context.Context, flow string, bytes int) error {
|
||||
target := p.reserveAt(time.Now(), flow, bytes)
|
||||
p.reservations.Add(1)
|
||||
if delay := time.Until(target); delay > 0 {
|
||||
timer := time.NewTimer(delay)
|
||||
defer timer.Stop()
|
||||
|
||||
Reference in New Issue
Block a user