Skip to content

Commit

Permalink
Use PoolingAsyncValueTaskMethodBuilder on ReadStreamMessageAsync meth…
Browse files Browse the repository at this point in the history
…od (#1850)

Co-authored-by: James Newton-King <[email protected]>
  • Loading branch information
mayuki and JamesNK authored Aug 18, 2022
1 parent d250e28 commit 77ae8af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Grpc.AspNetCore.Server/Internal/PipeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO.Pipelines;
using System.Runtime.CompilerServices;
using Grpc.Core;
using Grpc.Net.Compression;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -280,6 +281,9 @@ public static async ValueTask<T> ReadSingleMessageAsync<T>(this PipeReader input
/// <param name="deserializer">Message deserializer.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Complete message data or null if the stream is complete.</returns>
#if NET6_0_OR_GREATER
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<>))]
#endif
public static async ValueTask<T?> ReadStreamMessageAsync<T>(this PipeReader input, HttpContextServerCallContext serverCallContext, Func<DeserializationContext, T> deserializer, CancellationToken cancellationToken = default)
where T : class
{
Expand Down

0 comments on commit 77ae8af

Please sign in to comment.