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 spring-projectsgh-24989
  • Loading branch information
rstoyanchev authored and zx20110729 committed Feb 18, 2022
1 parent 85e4b46 commit 0c6d1e1
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 0c6d1e1

Please sign in to comment.