[zeromq-dev] PeriodicCallback timeout?
Indradhanush Gupta
indradhanush.gupta at gmail.com
Thu Jul 3 10:14:19 CEST 2014
Hello,
I am using a PeriodicCallback in pyzmq, that checks a python Queue for data
that needs to be sent.
It looks like this -
self.to_client = Queue.Queue()
def check_to_client(self):
while not self.to_client.empty():
data = self.to_client.get()
self.frontend.send(data)
So, going by the current callback definition, it sends each element of the
Queue until it is empty. I am wondering if this is good. It appears, that
this callback might block if the Queue is very large.
I have two approaches in mind.
1. Send n items, then return, where n = a number that will not block. So is
there an idea on what might be a good number?
2. Use a timeout on check_to_client, such that it runs for n milliseconds
and returns. Again what would be a good enough number for this? But also,
is this even possible?
Any other solution that someone has used before? This appears to be a very
common problem.
Thanks,
--
Indradhanush Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140703/c2059bfe/attachment.htm>
More information about the zeromq-dev
mailing list