From f234376034566fb6579306cfe9bb9cd812fd507c Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 6 Sep 2017 17:01:33 +0200 Subject: [PATCH] [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. f2f99dc091947c0799b17c767a6ad923cd535025 --- addons/bus/models/bus.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/bus/models/bus.py b/addons/bus/models/bus.py index 645b67d2607..e58bc8f0276 100644 --- a/addons/bus/models/bus.py +++ b/addons/bus/models/bus.py @@ -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: