[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.

Cherry-pick of rev. f2f99dc091
This commit is contained in:
Fabien Meghazi
2017-09-19 16:57:00 +02:00
parent 4e9b5e8f23
commit f234376034
+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: