[FIX] bus: compatibility with Odoo's PAAS external long polling handler

Add a `peek` option in the bus event dispatcher polling in order to let
an external event dispatcher fetch the notifications and their
corresponding channels.
This commit is contained in:
Fabien Meghazi
2017-09-13 09:48:25 +02:00
parent a2ed3d3d5b
commit f2f99dc091
+5
View File
@@ -128,6 +128,11 @@ class ImDispatch(object):
with registry.cursor() as cr:
env = api.Environment(cr, SUPERUSER_ID, {})
notifications = env['bus.bus'].poll(channels, last, options)
# immediatly returns in peek mode
if options.get('peek'):
return dict(notifications=notifications, channels=channels)
# or wait for future ones
if not notifications:
if not self.started: