Skip to content

Commit

Permalink
[ServiceBus] Cache UpdateDispositionWorkItem Mono (#22317)
Browse files Browse the repository at this point in the history
  • Loading branch information
YijunXieMS authored Jun 22, 2021
1 parent 23260e7 commit c0d060f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private Mono<Void> updateDispositionInternal(String lockToken, DeliveryState del
}

final UpdateDispositionWorkItem workItem = new UpdateDispositionWorkItem(lockToken, deliveryState, timeout);
final Mono<Void> result = Mono.create(sink -> {
final Mono<Void> result = Mono.<Void>create(sink -> {
workItem.start(sink);
try {
provider.getReactorDispatcher().invoke(() -> {
Expand All @@ -250,7 +250,7 @@ private Mono<Void> updateDispositionInternal(String lockToken, DeliveryState del
sink.error(new AmqpException(false, "updateDisposition failed while dispatching to Reactor.",
error, handler.getErrorContext(receiver)));
}
});
}).cache(); // cache because closeAsync use `when` to subscribe this Mono again.

workItem.setMono(result);

Expand Down

0 comments on commit c0d060f

Please sign in to comment.