Skip to content
This repository was archived by the owner on Sep 17, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions amonpy/protocols/zeromq.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ class ZeroMQHandler():
def __init__(self, socktype=zmq.DEALER):
self.ctx = zmq.Context.instance()
self.socket = zmq.Socket(self.ctx, socktype)
self.socket.setsockopt(zmq.LINGER, 0)
self.socket.setsockopt(zmq.SWAP, 25000000) # 25MB disk swap
self.socket.setsockopt(zmq.LINGER, 100)
# As there is no high water mark set - we don't really need this
# Additionally, its not possible to set location of these yet
# https://zeromq.jira.com/browse/LIBZMQ-410
#self.socket.setsockopt(zmq.SWAP, 25000000) # 25MB disk swap

address = "tcp://{0}".format(config.address)
self.socket.connect(address)
Expand All @@ -16,7 +19,7 @@ def close(self):

def post(self, data, type=None):
data = {"type": type, "content" : data}
if config.application_key:
if config.secret_key:
data['secret_key'] = config.secret_key

self.socket.send_json(data, zmq.NOBLOCK)
Expand Down