Skip to content

Commit 54aef03

Browse files
committed
fix: Fix loadbalance not balancing effectively when under pressure and queueing more payloads than it should on single endpoints
1 parent 6de1bd9 commit 54aef03

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lc-lib/publisher/endpoint/endpoint.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,8 @@ func (e *Endpoint) queuePayload(payload *payload.Payload) error {
163163

164164
e.mutex.Lock()
165165
e.numPayloads++
166-
e.mutex.Unlock()
167-
168166
e.updateEstDelTime()
167+
e.mutex.Unlock()
169168

170169
if e.numPayloads == 1 {
171170
e.transmissionStart = time.Now()
@@ -233,7 +232,7 @@ func (e *Endpoint) ReduceLatency() {
233232
func (e *Endpoint) updateEstDelTime() {
234233
e.estDelTime = time.Now()
235234
for _, payload := range e.pendingPayloads {
236-
e.estDelTime.Add(time.Duration(e.averageLatency) * time.Duration(payload.Size()))
235+
e.estDelTime = e.estDelTime.Add(time.Duration(e.averageLatency) * time.Duration(payload.Size()))
237236
}
238237
}
239238

0 commit comments

Comments
 (0)