diff --git a/docs/changelog.rst b/docs/changelog.rst index 3b0336a0..123ca456 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,14 @@ Changelog This changelog is used to track all major changes to Mopidy. +v1.0.2 (unreleased) +=================== + +Bug fix release. + +- HTTP: Make event broadcasts work with Tornado 2.3, the previous threading fix + broke this. + v1.0.1 (2015-04-23) =================== diff --git a/mopidy/http/handlers.py b/mopidy/http/handlers.py index 4f4b5988..e2faa944 100644 --- a/mopidy/http/handlers.py +++ b/mopidy/http/handlers.py @@ -88,9 +88,13 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler): @classmethod def broadcast(cls, msg): + if hasattr(tornado.ioloop.IOLoop, 'current'): + loop = tornado.ioloop.IOLoop.current() + else: + loop = tornado.ioloop.IOLoop.instance() # Fallback for 2.3 + # This can be called from outside the Tornado ioloop, so we need to # safely cross the thread boundary by adding a callback to the loop. - loop = tornado.ioloop.IOLoop.current() for client in cls.clients: # One callback per client to keep time we hold up the loop short loop.add_callback(_send_broadcast, client, msg)