Skip to content

Commit 3b26f01

Browse files
committed
Destroy rd_kafka_t handle on consumer.close() (#30)
1 parent ab60427 commit 3b26f01

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

confluent_kafka/src/Consumer.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,18 @@ static PyObject *Consumer_poll (Handle *self, PyObject *args,
391391

392392
static PyObject *Consumer_close (Handle *self, PyObject *ignore) {
393393
CallState cs;
394+
int raise = 0;
394395

395396
CallState_begin(self, &cs);
396397

397398
rd_kafka_consumer_close(self->rk);
398399

399-
if (!CallState_end(self, &cs))
400+
raise = !CallState_end(self, &cs);
401+
402+
rd_kafka_destroy(self->rk);
403+
self->rk = NULL;
404+
405+
if (raise)
400406
return NULL;
401407

402408
Py_RETURN_NONE;

0 commit comments

Comments
 (0)