Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Fix PartitionedProducerImpl::closeAsync to close sub-producers properly #125

Merged
merged 10 commits into from
Nov 28, 2022
11 changes: 4 additions & 7 deletions lib/PartitionedProducerImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,10 @@ void PartitionedProducerImpl::closeAsync(CloseCallback originalCallback) {
originalCallback(result);
}
};
if (state_ == Closed) {
closeCallback(ResultAlreadyClosed);
return;
}
State expectedState = Ready;
if (!state_.compare_exchange_strong(expectedState, Closing)) {
return;

State previous_state = state_.exchange(Closed);
if (previous_state == Closed) {
return closeCallback(ResultAlreadyClosed);
erobot marked this conversation as resolved.
Show resolved Hide resolved
}
erobot marked this conversation as resolved.
Show resolved Hide resolved

cancelTimers();
Expand Down