mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		@@ -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()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user