How about replacing the Queue with zmq sockets? Then you could just add the
"consumer" socket to the event loop.
On 3 Jul 2014 16:15, "Indradhanush Gupta" <indradhanush.gu...@gmail.com>
wrote:

> 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
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to