mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-03 20:18:06 +00:00
destruct callbacks (and their closures) to ensure there are no reference cycles when destructing the consumer. This solves a hang in rd_kafka_destroy
This commit is contained in:
@@ -66,6 +66,11 @@ Consumer::Consumer(Configuration config)
|
|||||||
|
|
||||||
Consumer::~Consumer() {
|
Consumer::~Consumer() {
|
||||||
try {
|
try {
|
||||||
|
// make sure to destroy the function closures. in case they hold kafka
|
||||||
|
// objects, they will need to be destroyed before we destroy the handle
|
||||||
|
assignment_callback_ = nullptr;
|
||||||
|
revocation_callback_ = nullptr;
|
||||||
|
rebalance_error_callback_ = nullptr;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
catch (const Exception&) {
|
catch (const Exception&) {
|
||||||
|
|||||||
Reference in New Issue
Block a user