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

ZeroMq HighWaterMark socket option #98

Merged
merged 3 commits into from
Feb 14, 2013
Merged

ZeroMq HighWaterMark socket option #98

merged 3 commits into from
Feb 14, 2013

Conversation

overplumbum
Copy link
Contributor

Allows to specify zeromq_hwm socket option to prevent uncontrolled memory consumption during network failure in push mode.

@josegonzalez
Copy link
Member

This needs to also be in beaver_config with a default...

@overplumbum
Copy link
Contributor Author

ok, i've added config entry

@@ -14,6 +14,10 @@ def __init__(self, beaver_config, file_config, logger=None):
self._ctx = zmq.Context()
self._pub = self._ctx.socket(zmq.PUSH)

zeromq_hwm = beaver_config.get('zeromq_hwm')
if zeromq_hwm:
self._pub.hwm = int(zeromq_hwm)
Copy link
Member

Choose a reason for hiding this comment

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

@overplumbum
Copy link
Contributor Author

fixed. btw code contains other "misplaced" conversions:

beaver/queue.py:26:                    if failure_count > int(beaver_config.get('max_failure')):
beaver/queue.py:27:                        failure_count = int(beaver_config.get('max_failure'))
beaver/queue.py:29:                    sleep_time = int(beaver_config.get('respawn_delay')) ** failure_count
beaver/rabbitmq_transport.py:24:            port=int(beaver_config.get('rabbitmq_port')),
beaver/redis_transport.py:20:        self._redis = redis.StrictRedis(host=_url.hostname, port=_url.port, password=redis_password, db=int(_db), socket_timeout=10)
beaver/udp_transport.py:14:        self._address = (beaver_config.get('udp_host'), int(beaver_config.get('udp_port')))

@josegonzalez
Copy link
Member

Okay, feel free to fix the mixplaced conversions! :)

josegonzalez added a commit that referenced this pull request Feb 14, 2013
ZeroMq HighWaterMark socket option
@josegonzalez josegonzalez merged commit f5310c8 into python-beaver:master Feb 14, 2013
@josegonzalez
Copy link
Member

Merged, thanks for the pull request!

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.

None yet

2 participants