Skip to content

Commit 4360500

Browse files
authored
Change return code of MultiTopicsConsumerImpl::closeAsync after unsubscribe or close (#413)
Fixes #88 ### Motivation #338 fixed `ConsumerImpl::closeAsync` so that closing after it was already closed or unsubscribed returns `ResultOk` instead of `ResultAlreadyClosed`. However, `MultiTopicsConsumerImpl::closeAsync` still returns `ResultAlreadyClosed`. This seems to be a change omission.
1 parent 747c186 commit 4360500

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/MultiTopicsConsumerImpl.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void MultiTopicsConsumerImpl::closeAsync(ResultCallback originalCallback) {
475475
};
476476
const auto state = state_.load();
477477
if (state == Closing || state == Closed) {
478-
callback(ResultAlreadyClosed);
478+
callback(ResultOk);
479479
return;
480480
}
481481

@@ -488,7 +488,7 @@ void MultiTopicsConsumerImpl::closeAsync(ResultCallback originalCallback) {
488488
if (consumers.empty()) {
489489
LOG_DEBUG("TopicsConsumer have no consumers to close "
490490
<< " topic" << topic() << " subscription - " << subscriptionName_);
491-
callback(ResultAlreadyClosed);
491+
callback(ResultOk);
492492
return;
493493
}
494494

tests/BasicEndToEndTest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,7 @@ TEST(BasicEndToEndTest, testSeekOnPartitionedTopic) {
16941694
ASSERT_EQ(expected.str(), msgReceived.getDataAsString());
16951695
ASSERT_EQ(ResultOk, consumer.acknowledge(msgReceived));
16961696
ASSERT_EQ(ResultOk, consumer.unsubscribe());
1697-
ASSERT_EQ(ResultAlreadyClosed, consumer.close());
1697+
ASSERT_EQ(ResultOk, consumer.close());
16981698
ASSERT_EQ(ResultOk, producer.close());
16991699
ASSERT_EQ(ResultOk, client.close());
17001700
}

0 commit comments

Comments
 (0)