Skip to content

Commit

Permalink
Add an option to define max sockets per context
Browse files Browse the repository at this point in the history
  • Loading branch information
com4 committed Jul 17, 2018
1 parent 5877caf commit 60350e0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions docs/settings_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Default: False

Enable most verbose level of debug statements

max_sockets
===========
Default: 1024

Define the max sockets for a Sender

******
Router
******
Expand Down
2 changes: 1 addition & 1 deletion eventmq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = 'EventMQ Contributors'
__version__ = '0.3.6'
__version__ = '0.3.7'

PROTOCOL_VERSION = 'eMQP/1.0'

Expand Down
3 changes: 3 additions & 0 deletions eventmq/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#: Default: True
HIDE_HEARTBEAT_LOGS = True

#: The maximum number of sockets to open per-process/context
MAX_SOCKETS = 1024

# When a queue name isn't specified use this queue name for the default. It
# would be a good idea to have a handful of workers listening on this queue
# unless you're positive that everything specifies a queue with workers.
Expand Down
3 changes: 2 additions & 1 deletion eventmq/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import zmq

from . import constants, exceptions
from . import conf, constants, exceptions
from .utils.classes import ZMQReceiveMixin, ZMQSendMixin

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -56,6 +56,7 @@ def __init__(self, *args, **kwargs):
"""
self.zcontext = kwargs.pop('context', zmq.Context.instance())
self.zcontext.set(zmq.MAX_SOCKETS, conf.MAX_SOCKETS)

# Set zsocket to none so we can check if it exists and close it before
# rebuilding it later.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='eventmq',
version='0.3.6',
version='0.3.7',
description='EventMQ job execution and messaging system based on ZeroMQ',
packages=find_packages(),
install_requires=['pyzmq==15.4.0',
Expand Down

0 comments on commit 60350e0

Please sign in to comment.