From f2f99dc091947c0799b17c767a6ad923cd535025 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. --- 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 8b04b450a86..0af875cecbb 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: