From e0b64c6b2f6f75ed683942ed5b5c3c66fad66dc4 Mon Sep 17 00:00:00 2001 From: Michal Kuratczyk Date: Tue, 14 Jan 2025 16:12:05 +0100 Subject: [PATCH] Allow InitialCredit/MoreCreditAfter of zero (#13067) https://github.com/rabbitmq/rabbitmq-server/pull/13046 introduced additional checks which prevent setting `{credit_flow_default_credit,{0,0}}`. Setting credits to zero allows disabling the credit flow mechanism (we use it in our benchmarks and mention for example in https://www.rabbitmq.com/blog/2023/03/21/native-mqtt) (cherry picked from commit a4634d3f7062544961e95a5498d62008d163f293) --- deps/rabbit/src/rabbit.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/rabbit/src/rabbit.erl b/deps/rabbit/src/rabbit.erl index 6e5d95d79297..c5b0eaaed26c 100644 --- a/deps/rabbit/src/rabbit.erl +++ b/deps/rabbit/src/rabbit.erl @@ -1761,8 +1761,8 @@ persist_static_configuration() -> {ok, {InitialCredit, MoreCreditAfter}} when is_integer(InitialCredit) andalso is_integer(MoreCreditAfter) andalso - InitialCredit > 0 andalso - MoreCreditAfter > 0 andalso + InitialCredit >= 0 andalso + MoreCreditAfter >= 0 andalso MoreCreditAfter =< InitialCredit -> {InitialCredit, MoreCreditAfter}; Other ->