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

Contributing #715

Closed
keith-chew opened this issue Nov 21, 2019 · 2 comments
Closed

Contributing #715

keith-chew opened this issue Nov 21, 2019 · 2 comments
Labels
stale Stale issues

Comments

@keith-chew
Copy link

Hi

I would like to make a pull request, to expose the _isDisconnecting flag in client.js. This will allow the application to determine if node-rdkafka is in the middle of disconnecting, when calling disconnect() in an async fashion.

Please see below for the simple patch, as I am not sure I have the permissions to push my branch. Please advise next steps.

From 1f5b1b93fe3a664a558450bf1e8601a257f054fb Mon Sep 17 00:00:00 2001
From: Keith Chew <keith.chew@propellerhead.co.nz>
Date: Thu, 21 Nov 2019 20:23:54 +1300
Subject: [PATCH] expose isDisconnecting flag

---
 lib/client.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/client.js b/lib/client.js
index 96d1be7..92fd2fb 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -83,6 +83,7 @@ function Client(globalConf, SubClientType, topicConf) {
 
   this.metrics = {};
   this._isConnected = false;
+  this._isDisconnecting = false;
   this.errorCounter = 0;
 
   /**
@@ -254,6 +255,15 @@ Client.prototype.isConnected = function() {
   return !!(this._isConnected && this._client);
 };
 
+/**
+ * Whether or not we are disconnecting from Kafka.
+ *
+ * @return {boolean} - Whether we are disconnecting.
+ */
+Client.prototype.isDisconnecting = function() {
+    return !!(this._isDisconnecting && this._client);
+  };
+  
 /**
  * Get the last error emitted if it exists.
  *
-- 
2.18.0.windows.1
@keith-chew
Copy link
Author

Pull Request here:
#718

For those who are interested, fork here:
https://github.com/keith-chew/node-rdkafka

@stale
Copy link

stale bot commented Feb 21, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale Stale issues label Feb 21, 2020
@stale stale bot closed this as completed Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issues
Projects
None yet
Development

No branches or pull requests

1 participant