From 6b005343dcc9b41ded519e3c2ceb35d5eeedde5a Mon Sep 17 00:00:00 2001 From: Pavel Zbitskiy Date: Fri, 14 Feb 2025 20:05:23 -0500 Subject: [PATCH 1/2] txHandler: do not drop accepted mgs --- data/txHandler.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/txHandler.go b/data/txHandler.go index 65fd869d7e..1a658e192e 100644 --- a/data/txHandler.go +++ b/data/txHandler.go @@ -638,15 +638,15 @@ func (handler *TxHandler) incomingMsgErlCheck(sender network.DisconnectableAddre // is sufficient to indicate that we should enable Congestion Control, because // an issue in vending capacity indicates the underlying resource (TXBacklog) is full capguard, isCMEnabled, err = handler.erl.ConsumeCapacity(sender.(util.ErlClient)) - if err != nil || // did ERL ask to enable congestion control? - (!isCMEnabled && congestedERL) { // is CM not currently enabled, but queue is congested? + if err != nil { handler.erl.EnableCongestionControl() // if there is no capacity, it is the same as if we failed to put the item onto the backlog, so report such transactionMessagesDroppedFromBacklog.Inc(nil) return capguard, true - } - // if the backlog Queue has 50% of its buffer back, turn congestion control off - if !congestedERL { + } else if !isCMEnabled && congestedERL { // is CM not currently enabled, but queue is congested? + // if the backlog Queue has 50% of its buffer back, turn congestion control off + handler.erl.EnableCongestionControl() + } else if !congestedERL { handler.erl.DisableCongestionControl() } } From 2805a8d5f89c75e18713ba0b4ea9d430a6f65be3 Mon Sep 17 00:00:00 2001 From: Pavel Zbitskiy Date: Sat, 15 Feb 2025 15:28:19 -0500 Subject: [PATCH 2/2] fix misplaced comments --- data/txHandler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/txHandler.go b/data/txHandler.go index 1a658e192e..efa2d972d8 100644 --- a/data/txHandler.go +++ b/data/txHandler.go @@ -638,15 +638,15 @@ func (handler *TxHandler) incomingMsgErlCheck(sender network.DisconnectableAddre // is sufficient to indicate that we should enable Congestion Control, because // an issue in vending capacity indicates the underlying resource (TXBacklog) is full capguard, isCMEnabled, err = handler.erl.ConsumeCapacity(sender.(util.ErlClient)) - if err != nil { + if err != nil { // did ERL ask to enable congestion control? handler.erl.EnableCongestionControl() // if there is no capacity, it is the same as if we failed to put the item onto the backlog, so report such transactionMessagesDroppedFromBacklog.Inc(nil) return capguard, true } else if !isCMEnabled && congestedERL { // is CM not currently enabled, but queue is congested? - // if the backlog Queue has 50% of its buffer back, turn congestion control off handler.erl.EnableCongestionControl() } else if !congestedERL { + // if the backlog Queue has 50% of its buffer back, turn congestion control off handler.erl.DisableCongestionControl() } }