From 24bcbc926e266e7c8dd2be2cc8d81463b823590d 2011-08-03 21:59:10 From: MinRK Date: 2011-08-03 21:59:10 Subject: [PATCH] flush pub_socket in OutStream.flush This is for when stream.pub_socket is actually a ZMQStream, which would otherwise wait until the event loop iterates to actually call the socket send. --- diff --git a/IPython/zmq/iostream.py b/IPython/zmq/iostream.py index a65bb8d..5fcfb98 100644 --- a/IPython/zmq/iostream.py +++ b/IPython/zmq/iostream.py @@ -45,6 +45,9 @@ class OutStream(object): msg = self.session.send(self.pub_socket, u'stream', content=content, parent=self.parent_header, ident=self.topic) + if hasattr(self.pub_socket, 'flush'): + # socket itself has flush (presumably ZMQStream) + self.pub_socket.flush() self._buffer.close() self._new_buffer()