Skip to content

Commit 20221e9

Browse files
committed
call_later is new in tornado 4
not present in pyzmq's bundled IOLoop
1 parent 6b0e0c6 commit 20221e9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ipykernel/iostream.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# coding: utf-8
12
"""Wrappers for forwarding stdout/stderr over zmq"""
23

34
# Copyright (c) IPython Development Team.
@@ -245,9 +246,11 @@ def _schedule_flush(self):
245246
# non-None to avoid races while waiting for _schedule
246247
self._flush_timeout = 'placeholder'
247248

248-
# call_later has to be handed to the io thread with add_callback
249+
# add_timeout has to be handed to the io thread with add_callback
249250
def _schedule_in_thread():
250-
self._flush_timeout = self._io_loop.call_later(self.flush_interval, self._flush)
251+
# FIXME: call_later is a little nicer, if we can require tornado ≥ 4
252+
self._flush_timeout = self._io_loop.add_timeout(
253+
self._io_loop.time() + self.flush_interval, self._flush)
251254
self._io_loop.add_callback(_schedule_in_thread)
252255

253256
def flush(self):

0 commit comments

Comments
 (0)