Skip to content

Commit

Permalink
Revert "Add doOnDiscard hook for streaming mode"
Browse files Browse the repository at this point in the history
This reverts commit 77a562d.

As per findings under
reactor/reactor-netty#1746 it looks this
wasn't the issue and isn't required.
  • Loading branch information
rstoyanchev authored and lxbzmy committed Mar 26, 2022
1 parent 9dca6d5 commit 91fbdc5
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,16 @@ public Mono<Void> write(Publisher<? extends T> inputStream, ResolvableType eleme
}

if (isStreamingMediaType(contentType)) {
return message
.writeAndFlushWith(body.map(buffer -> {
Hints.touchDataBuffer(buffer, hints, logger);
return Mono.just(buffer).doOnDiscard(PooledDataBuffer.class, DataBufferUtils::release);
}))
.doOnDiscard(PooledDataBuffer.class, DataBufferUtils::release);
return message.writeAndFlushWith(body.map(buffer -> {
Hints.touchDataBuffer(buffer, hints, logger);
return Mono.just(buffer).doOnDiscard(PooledDataBuffer.class, DataBufferUtils::release);
}));
}

if (logger.isDebugEnabled()) {
body = body.doOnNext(buffer -> Hints.touchDataBuffer(buffer, hints, logger));
}
return message.writeWith(body).doOnDiscard(PooledDataBuffer.class, DataBufferUtils::release);
return message.writeWith(body);
}

@Nullable
Expand Down

0 comments on commit 91fbdc5

Please sign in to comment.