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

conn.py performance improvements, make examples work, add another example #134

Merged
merged 7 commits into from
Mar 22, 2014

Conversation

wizzat
Copy link
Collaborator

@wizzat wizzat commented Feb 25, 2014

The change consists of:

  • Adding load_example.py, which shows large message behavior.
  • Updating example.py to actually compile and run.
  • Adding ErrorString handling so that human readable error messages are easier to get to.
  • Refactoring conn.py to use a common init/reinit pattern.
  • Refactoring conn.py to use ''.join() instead of str += str (~5-10% performance increase on my limited testing)

self.timeout = timeout
self._sock.settimeout(self.timeout)
self._dirty = False
self._sock = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to set _socket here since it's set in reinit()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self._sock is required because the first line of reinit() asks "if not self._sock"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you mean in close(). You're right

@dpkp
Copy link
Owner

dpkp commented Mar 22, 2014

looks good to me

dpkp added a commit that referenced this pull request Mar 22, 2014
conn.py performance improvements, make examples work, add another example
@dpkp dpkp merged commit 9bed11d into dpkp:master Mar 22, 2014
@wizzat wizzat deleted the conn_refactor branch March 22, 2014 06:25
wbarnha added a commit to alfaix/kafka-python that referenced this pull request Mar 10, 2024
…pkp#134)

wakeup

When wakeup() is called, we sometime notice that we get
an endless prints:
"Unable to send to wakeup socket!".

Those prints are spamming the logs.
This commit aims to address it by allowing restating the
application via an intentional exception raise.
This behavior is configurable and its default is backward compatible.

Signed-off-by: shimon-armis <shimon.turjeman@armis.com>
Co-authored-by: shimon-armis <shimon.turjeman@armis.com>
bradenneal1 pushed a commit to bradenneal1/kafka-python that referenced this pull request May 16, 2024
…pkp#134)

wakeup

When wakeup() is called, we sometime notice that we get
an endless prints:
"Unable to send to wakeup socket!".

Those prints are spamming the logs.
This commit aims to address it by allowing restating the
application via an intentional exception raise.
This behavior is configurable and its default is backward compatible.

Signed-off-by: shimon-armis <shimon.turjeman@armis.com>
Co-authored-by: shimon-armis <shimon.turjeman@armis.com>
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.

3 participants