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

Added a function to determine if bootstrap is successfully connected #1876

Merged
merged 4 commits into from
Sep 30, 2019

Conversation

Wayde2014
Copy link
Contributor

@Wayde2014 Wayde2014 commented Aug 3, 2019

Added a function to determine if bootstrap is successfully connected


This change is Reviewable

@dpkp
Copy link
Owner

dpkp commented Sep 29, 2019

I like the idea! Rather than adding more state to the KafkaProducer (self._client), maybe delegate this function to the Sender class, which owns the client instance?

@dpkp dpkp merged commit 7a7a890 into dpkp:master Sep 30, 2019
@Wayde2014
Copy link
Contributor Author

Wayde2014 commented Oct 9, 2019

@dpkp I tested your optimized bootstrap_connected function, then found that it was not what I wanted.
However, when I changed the bootstrap_connected function as the following code, it work correctly.

    def bootstrap_connected(self):
        """Return True if a bootstrap node is connected"""
        if self._bootstrap_fails > 0:
            return False
        return True

old code:

    def bootstrap_connected(self):
        """Return True if a bootstrap node is connected"""
        for node_id in self._conns:
            if not self.cluster.is_bootstrap(node_id):
                continue
            if self._conns[node_id].connected():
                return True
        else:
            return False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants