put global variables for fine tuning
bzr revid: nicolas.vanhoren@openerp.com-20121127144724-8b9tc0ix6xplpojp
This commit is contained in:
parent
69db26392f
commit
f48a0c4a8b
|
@ -24,6 +24,8 @@ import openerp.tools.config
|
|||
import openerp.modules.registry
|
||||
from osv import osv, fields
|
||||
|
||||
WATCHER_TIMER = 60
|
||||
POLL_TIMER = 30
|
||||
|
||||
if openerp.tools.config.options["gevent"]:
|
||||
import gevent
|
||||
|
@ -59,7 +61,7 @@ if openerp.tools.config.options["gevent"]:
|
|||
try:
|
||||
c.execute("listen received_message;")
|
||||
c.commit();
|
||||
if select.select([conn], [], [], 60) == ([],[],[]):
|
||||
if select.select([conn], [], [], WATCHER_TIMER) == ([],[],[]):
|
||||
pass
|
||||
else:
|
||||
conn.poll()
|
||||
|
@ -99,7 +101,7 @@ class ImportController(openerp.addons.web.http.Controller):
|
|||
last = res["last"]
|
||||
num += 1
|
||||
print "waiting"
|
||||
Watcher.get_watcher(res["dbname"]).stop(30)
|
||||
Watcher.get_watcher(res["dbname"]).stop(POLL_TIMER)
|
||||
|
||||
|
||||
class im_message(osv.osv):
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
|
||||
openerp.web_im = function(instance) {
|
||||
|
||||
var USERS_LIMIT = 20;
|
||||
var ERROR_DELAY = 5000;
|
||||
|
||||
instance.web.UserMenu.include({
|
||||
do_update: function(){
|
||||
var self = this;
|
||||
|
@ -59,7 +62,7 @@ openerp.web_im = function(instance) {
|
|||
}
|
||||
var users = new instance.web.Model("res.users");
|
||||
var self = this;
|
||||
return users.query(["name"]).filter([["name", "ilike", this.$(".oe_im_input").val()]]).limit(20).all().then(function(result) {
|
||||
return users.query(["name"]).filter([["name", "ilike", this.$(".oe_im_input").val()]]).limit(USERS_LIMIT).all().then(function(result) {
|
||||
self.$(".oe_im_input").val("");
|
||||
_.each(self.users, function(user) {
|
||||
user.destroy();
|
||||
|
@ -105,7 +108,7 @@ openerp.web_im = function(instance) {
|
|||
self.poll();
|
||||
}, function(unused, e) {
|
||||
e.preventDefault();
|
||||
setTimeout(_.bind(self.poll, self), 5000);
|
||||
setTimeout(_.bind(self.poll, self), ERROR_DELAY);
|
||||
});
|
||||
},
|
||||
activate_user: function(user_rec) {
|
||||
|
|
Loading…
Reference in New Issue