IDEMPIERE-729 Firefox becomes very slow randomly after working on zkwebui. Reduce timeout and GC cycle for xmlhttprequest.
This commit is contained in:
parent
1e2ea6386d
commit
ac67fe763e
|
@ -49,7 +49,7 @@ public class AtmosphereServerPush implements ServerPush {
|
|||
|
||||
private static final String ON_ACTIVATE_DESKTOP = "onActivateDesktop";
|
||||
|
||||
public static final int DEFAULT_TIMEOUT = 1000 * 60 * 5;
|
||||
public static final int DEFAULT_TIMEOUT = 1000 * 60 * 2;
|
||||
|
||||
private final AtomicReference<Desktop> desktop = new AtomicReference<Desktop>();
|
||||
|
||||
|
@ -181,8 +181,7 @@ public class AtmosphereServerPush implements ServerPush {
|
|||
}
|
||||
|
||||
log.debug("Starting server push for " + desktop);
|
||||
int clientTimeout = timeout + 1000 * 60;
|
||||
Clients.response("jawwa.atmosphere.serverpush", new AuScript(null, "jawwa.atmosphere.startServerPush('" + desktop.getId() + "', " + clientTimeout
|
||||
Clients.response("jawwa.atmosphere.serverpush", new AuScript(null, "jawwa.atmosphere.startServerPush('" + desktop.getId() + "', " + timeout
|
||||
+ ");"));
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,13 +15,37 @@
|
|||
jawwa.atmosphere.ServerPush = zk.$extends(zk.Object, {
|
||||
desktop: null,
|
||||
active: false,
|
||||
timeout: 300000,
|
||||
delay: 100,
|
||||
delay: 250,
|
||||
failures: 0,
|
||||
|
||||
timeout: 0,
|
||||
ajaxOptions: {
|
||||
url: zk.ajaxURI("/comet", {au: true}),
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: true,
|
||||
global: false,
|
||||
data: null,
|
||||
dataType: "text"
|
||||
},
|
||||
$init: function(desktop, timeout) {
|
||||
this.desktop = desktop;
|
||||
this.timeout = timeout;
|
||||
this.ajaxOptions.data = { dtid: this.desktop.id };
|
||||
this.ajaxOptions.timeout = this.timeout;
|
||||
var me = this;
|
||||
this.ajaxOptions.error = function(jqxhr, textStatus, errorThrown) {
|
||||
if (typeof console == "object") {
|
||||
console.error(textStatus);
|
||||
console.error(errorThrown);
|
||||
}
|
||||
me.failures += 1;
|
||||
me._schedule();
|
||||
};
|
||||
this.ajaxOptions.success = function(data) {
|
||||
zAu.cmd0.echo(this.desktop);
|
||||
me.failures = 0;
|
||||
me._schedule();
|
||||
};
|
||||
},
|
||||
_schedule: function() {
|
||||
if (this.failures < 20) {
|
||||
|
@ -35,34 +59,7 @@
|
|||
if (!this.active)
|
||||
return;
|
||||
|
||||
var me = this;
|
||||
var jqxhr = $.ajax({
|
||||
url: zk.ajaxURI("/comet", {
|
||||
au: true
|
||||
}),
|
||||
type: "GET",
|
||||
cache: false,
|
||||
async: true,
|
||||
global: false,
|
||||
data: {
|
||||
dtid: this.desktop.id
|
||||
},
|
||||
accepts: "text/plain",
|
||||
dataType: "text",
|
||||
timeout: me.timeout,
|
||||
error: function(jqxhr, textStatus, errorThrown) {
|
||||
if (typeof console == "object") {
|
||||
console.error(errorThrown);
|
||||
}
|
||||
me.failures += 1;
|
||||
me._schedule();
|
||||
},
|
||||
success: function(data) {
|
||||
zAu.cmd0.echo(me.desktop);
|
||||
me.failures = 0;
|
||||
me._schedule();
|
||||
}
|
||||
});
|
||||
var jqxhr = $.ajax(this.ajaxOptions);
|
||||
this._req = jqxhr;
|
||||
},
|
||||
start: function() {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package name="jawwa.atmosphere" language="xul/html">
|
||||
<script src="jquery.atmosphere.js" />
|
||||
<script src="serverpush.js" />
|
||||
</package>
|
||||
|
|
Loading…
Reference in New Issue