Skip to content

Commit

Permalink
Fix race condition in WriteResultPublisher
Browse files Browse the repository at this point in the history
Closes gh-24989
  • Loading branch information
rstoyanchev committed May 1, 2020
1 parent e17736d commit c35b3e5
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -175,6 +175,9 @@ void subscribe(WriteResultPublisher publisher, Subscriber<? super Void> subscrib
@Override
void publishComplete(WriteResultPublisher publisher) {
publisher.completedBeforeSubscribed = true;
if(State.SUBSCRIBED.equals(publisher.state.get())) {
publisher.state.get().publishComplete(publisher);
}
}
@Override
void publishError(WriteResultPublisher publisher, Throwable ex) {
Expand All @@ -190,6 +193,9 @@ void request(WriteResultPublisher publisher, long n) {
@Override
void publishComplete(WriteResultPublisher publisher) {
publisher.completedBeforeSubscribed = true;
if(State.SUBSCRIBED.equals(publisher.state.get())) {
publisher.state.get().publishComplete(publisher);
}
}
@Override
void publishError(WriteResultPublisher publisher, Throwable ex) {
Expand Down

0 comments on commit c35b3e5

Please sign in to comment.