Ejemplo n.º 1
0
        private ValueTask RunLinesAsync(CancellationToken token)
        {
            ValueTask task = default;

            while (_channel.Reader.TryRead(out var line))
            {
                task = task.Append(ProcessAsync(line));
            }

            return(task);
        }
Ejemplo n.º 2
0
        public async Task RunAsync(HttpContext context)
        {
            ValueTask task = default;

            await foreach (var line in context.Request.BodyReader.LinesAsAsyncEnumerable(Pool))
            {
                task = task.Append(_forwarders.AddAsync(line));
            }

            await task;

            context.Response.StatusCode = 201;
        }