diff --git a/projects/RabbitMQ.Client/Impl/Channel.BasicPublish.cs b/projects/RabbitMQ.Client/Impl/Channel.BasicPublish.cs index a0a084d02..25b99a96f 100644 --- a/projects/RabbitMQ.Client/Impl/Channel.BasicPublish.cs +++ b/projects/RabbitMQ.Client/Impl/Channel.BasicPublish.cs @@ -32,6 +32,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using RabbitMQ.Client.Framing; @@ -220,5 +221,16 @@ void MaybeAddPublishSequenceNumberToHeaders(IDictionary headers } } } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private ValueTask EnforceFlowControlAsync(CancellationToken cancellationToken) + { + if (_flowControlBlock.IsSet) + { + return default; + } + + return _flowControlBlock.WaitAsync(cancellationToken); + } } } diff --git a/projects/RabbitMQ.Client/Impl/Channel.cs b/projects/RabbitMQ.Client/Impl/Channel.cs index 6ca0c9a93..ca749531b 100644 --- a/projects/RabbitMQ.Client/Impl/Channel.cs +++ b/projects/RabbitMQ.Client/Impl/Channel.cs @@ -450,17 +450,6 @@ protected ValueTask ModelSendAsync(in TMethod method, in THead return Session.TransmitAsync(in method, in header, body, cancellationToken); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected ValueTask EnforceFlowControlAsync(CancellationToken cancellationToken) - { - if (_flowControlBlock.IsSet) - { - return default; - } - - return _flowControlBlock.WaitAsync(cancellationToken); - } - internal Task OnCallbackExceptionAsync(CallbackExceptionEventArgs args) { return _callbackExceptionAsyncWrapper.InvokeAsync(this, args);