Skip to content

Commit

Permalink
Fix race condition in WriteResultPublisher
Browse files Browse the repository at this point in the history
Backport of c35b3e5

Closes gh-24989
  • Loading branch information
rstoyanchev committed May 4, 2020
1 parent ce76a9b commit 42f60fe
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 42f60fe

Please sign in to comment.