Skip to content

remove poll #276

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ if test "$PHP_RDKAFKA" != "no"; then
AC_MSG_WARN([murmur2 partitioner is not available])
])

AC_CHECK_LIB($LIBNAME,[rd_kafka_destroy_flags],[
AC_DEFINE(HAS_RD_KAFKA_DESTROY_FLAGS,1,[ ])
],[
AC_MSG_WARN([Destroy flags are not available])
])

LDFLAGS="$ORIG_LDFLAGS"
CPPFLAGS="$ORIG_CPPFLAGS"

Expand Down
10 changes: 6 additions & 4 deletions kafka_consumer.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ static void kafka_consumer_free(zend_object *object TSRMLS_DC) /* {{{ */
rd_kafka_resp_err_t err;

if (intern->rk) {
#ifdef HAS_RD_KAFKA_DESTROY_FLAGS
rd_kafka_destroy_flags(intern->rk, RD_KAFKA_DESTROY_F_NO_CONSUMER_CLOSE);
#else
err = rd_kafka_consumer_close(intern->rk);

if (err) {
php_error(E_WARNING, "rd_kafka_consumer_close failed: %s", rd_kafka_err2str(err));
} else {
while (rd_kafka_outq_len(intern->rk) > 0) {
rd_kafka_poll(intern->rk, 10);
}
}

rd_kafka_destroy(intern->rk);
#endif
intern->rk = NULL;
}

Expand Down