diff options
| author | Christophe Matthieu <chm@odoo.com> | 2018-04-25 12:25:45 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2018-08-09 02:31:59 +0200 |
| commit | 693c771111eb7fa6edaaa36bb86f3df64cc6b9ba (patch) | |
| tree | 5925bfa18820a3545b6f8a3b189ed8647839e59e /addons/bus/static | |
| parent | 23c0c791288bf132171eeeb43af54b8f12d5b880 (diff) | |
[IMP] web: abord the poll when destroy to avoid useless call
If the service bus are called and destroyed the rpc can be returned after, to
avoid a useless call to the database and unexpected behavior, we abort the
connection.
Diffstat (limited to 'addons/bus/static')
| -rw-r--r-- | addons/bus/static/src/js/bus.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/bus/static/src/js/bus.js b/addons/bus/static/src/js/bus.js index d0da7676f9f..bf5bb5277be 100644 --- a/addons/bus/static/src/js/bus.js +++ b/addons/bus/static/src/js/bus.js @@ -53,6 +53,7 @@ bus.Bus = Widget.extend({ }, destroy: function () { var self = this; + this.stop_polling(); $(window).off("focus." + this.bus_id); $(window).off("blur." + this.bus_id); $(window).off("unload." + this.bus_id); @@ -70,6 +71,9 @@ bus.Bus = Widget.extend({ this.activated = false; this.stop = true; this.channels = []; + if (this._pollRpc) { + this._pollRpc.abort(); + } }, poll: function () { var self = this; @@ -89,7 +93,7 @@ bus.Bus = Widget.extend({ this._pollRpc.then(function (result) { self._pollRpc = false; self.on_notification(result); - if (!self.stop) { + if (!self.stop && self.activated) { self.poll(); } }, function (error, event) { |
