@@ -292,13 +292,6 @@ def __init__(self, **kwargs):
292292 self ._do_exec_accepted_params = _accepts_parameters (
293293 self .do_execute , ["cell_meta" , "cell_id" ]
294294 )
295-
296- def _publish_status_and_flush (self , status , channel , stream ):
297- self ._publish_status (status , channel )
298- # flush to ensure reply is sent before
299- # handling the next request
300- if stream :
301- stream .flush (zmq .POLLOUT )
302295
303296 async def dispatch_control (self , msg ):
304297 # Ensure only one control message is processed at a time
@@ -599,6 +592,12 @@ def _publish_status(self, status, channel, parent=None):
599592 parent = parent or self .get_parent (channel ),
600593 ident = self ._topic ("status" ),
601594 )
595+
596+ def _publish_status_and_flush (self , status , channel , stream , parent = None ):
597+ """send status on IOPub and flush specified stream to ensure reply is sent before handling the next reply"""
598+ self ._publish_status (status , channel , parent )
599+ if stream :
600+ stream .flush (zmq .POLLOUT )
602601
603602 def _publish_debug_event (self , event ):
604603 if not self .session :
0 commit comments