tornado: Use spiffy new call_later rather than add_timeout.

This method was new in Tornado 4.0.  It saves us from having to get
the time ourselves and do the arithmetic -- which not only makes the
code a bit shorter, but also easier to get right.  Tornado docs (see
http://www.tornadoweb.org/en/stable/ioloop.html) say we should have
been getting the time from `ioloop.time()` rather than hardcoding
`time.time()`, because the loop could e.g. be running on the
`time.monotonic()` clock.
This commit is contained in:
Greg Price
2017-11-29 15:15:49 -08:00
committed by Tim Abbott
parent 73886f57d2
commit c32b16715d
4 changed files with 7 additions and 7 deletions

View File

@@ -380,7 +380,7 @@ def shutdown_handler(*args, **kwargs):
# type: (*Any, **Any) -> None
io_loop = IOLoop.instance()
if io_loop._callbacks:
io_loop.add_timeout(time.time() + 1, shutdown_handler)
io_loop.call_later(1, shutdown_handler)
else:
io_loop.stop()