停止longpolling cron调用即可轻松调试

时间:2019-03-05 08:04:18

标签: odoo-12

我正在尝试调试部分代码,但是/ longpolling / poll调用限制了我这样做。任何想法如何禁用它?

1 个答案:

答案 0 :(得分:0)

它开始工作了...我的意思是通过注释以下代码片段来停止longpolling / poll调用... Longpolling_bus.js ///行号173

 `_poll: function () {
            // var self = this;
            // if (!this._isActive) {
            //     return;
            // }
            // var now = new Date().getTime();
            // var options = _.extend({}, this._options, {
            //     bus_inactivity: now - this._getLastPresence(),
            // });
            // if (this._lastPartnersPresenceCheck + this.PARTNERS_PRESENCE_CHECK_PERIOD > now) {
            //     options = _.omit(options, 'bus_presence_partner_ids');
            // } else {
            //     this._lastPartnersPresenceCheck = now;
            // }
            // var data = {channels: this._channels, last: this._lastNotificationID, options: options};
            // // The backend has a maximum cycle time of 50 seconds so give +10 seconds
            // this._pollRpc = this._rpc({route: this.POLL_ROUTE, params: data}, {shadow : true, timeout: 60000});
            // this._pollRpc.then(function (result) {
            //     self._pollRpc = false;
            //     self._onPoll(result);
            //     self._poll();
            // }, function (error, ev) {
            //     self._pollRpc = false;
            //     // no error popup if request is interrupted or fails for any reason
            //     ev.preventDefault();
            //     if (error && error.message === "XmlHttpRequestError abort") {
            //         self._poll();
            //     } else {
            //         // random delay to avoid massive longpolling
            //         self._pollRetryTimeout = setTimeout(self._poll, self.ERROR_RETRY_DELAY + (Math.floor((Math.random()*20)+1)*1000));
            //     }
            // });
        }

`