IDEMPIERE-5011 Intermittent web client error at Firefox (#943)

- Desktop cleanup: fix timing issue with redirect
- index.zul: remove obsolete workaround for rmDesktop (desktop cleanup)
- serverpush.js: remove unreliable immediate stop of serverpush
This commit is contained in:
hengsin 2021-10-23 19:50:44 +08:00 committed by GitHub
parent 940586fa97
commit fe2b0bb966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 32 deletions

View File

@ -45,7 +45,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
</component> </component>
<javascript-module name="org.idempiere.websocket" version="202011211500"/> <javascript-module name="org.idempiere.websocket" version="202011211500"/>
<javascript-module name="jawwa.atmosphere" version="202102091500"/> <javascript-module name="jawwa.atmosphere" version="202110220730"/>
<javascript-module name="adempiere.local.storage" version="202011151100"/> <javascript-module name="adempiere.local.storage" version="202011151100"/>
<javascript-moudle name="html2canvas" version="1.3.1"/> <javascript-moudle name="html2canvas" version="1.3.1"/>
<javascript-module name="org.idempiere.commons" version="202107060204"/> <javascript-module name="org.idempiere.commons" version="202107060204"/>

View File

@ -250,6 +250,10 @@ public class SessionContextListener implements ExecutionInit,
} }
int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID); int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), Env.AD_SESSION_ID);
if (AD_Session_ID > 0) { if (AD_Session_ID > 0) {
//sleep 1s to avoid timing issue with login and logout (both uses redirect call)
Thread.sleep(1000);
String key = getSessionDesktopListKey(AD_Session_ID); String key = getSessionDesktopListKey(AD_Session_ID);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<String> list = (List<String>) Env.getCtx().get(key); List<String> list = (List<String>) Env.getCtx().get(key);

View File

@ -35,7 +35,7 @@
this.timeout = timeout; this.timeout = timeout;
this.ajaxOptions.data = { dtid: this.desktop.id }; this.ajaxOptions.data = { dtid: this.desktop.id };
this.ajaxOptions.timeout = this.timeout; this.ajaxOptions.timeout = this.timeout;
this.ajaxOptions.url = zk.ajaxURI("/comet", {au: true,desktop:this.desktop.id,ignoreSession:false}), this.ajaxOptions.url = zk.ajaxURI("/comet", {au: true,desktop:this.desktop.id,ignoreSession:true}),
this.trace = trace; this.trace = trace;
var me = this; var me = this;
this.ajaxOptions.error = function(jqxhr, textStatus, errorThrown) { this.ajaxOptions.error = function(jqxhr, textStatus, errorThrown) {
@ -43,15 +43,10 @@
console.log("error: " + textStatus + " dtid: " + me.desktop.id + " errorThrown: " + errorThrown + " status: " + jqxhr.status); console.log("error: " + textStatus + " dtid: " + me.desktop.id + " errorThrown: " + errorThrown + " status: " + jqxhr.status);
if (textStatus != "timeout" && textStatus != "abort" && errorThrown != "SessionNotFound") { if (textStatus != "timeout" && textStatus != "abort" && errorThrown != "SessionNotFound") {
console.error("error: " + textStatus + " errorThrown: " + errorThrown + " status: " + jqxhr.status); console.error("error: " + textStatus + " errorThrown: " + errorThrown + " status: " + jqxhr.status);
//stop immediately if server is not reachable
if (jqxhr.status == 404) {
me.failures = 3;
} else {
me.failures += 1; me.failures += 1;
} }
}
}; };
this.ajaxOptions.success = function(data) { this.ajaxOptions.success = function() {
if (me.trace) if (me.trace)
console.log("success" + " dtid: " + me.desktop.id); console.log("success" + " dtid: " + me.desktop.id);
zAu.cmd0.echo(this.desktop); zAu.cmd0.echo(this.desktop);
@ -72,8 +67,11 @@
}, },
_schedule: function() { _schedule: function() {
if (this.failures < 3) { if (this.failures < 3) {
var d = this.delay;
if (this._req && (this._req.status == 0 || this._req.status == 400))
d = 500;
this._req = null; this._req = null;
setTimeout(this.proxy(this._send), this.delay); setTimeout(this.proxy(this._send), d);
} else { } else {
this.stop(); this.stop();
jawwa.atmosphere.serverNotAvailable(); jawwa.atmosphere.serverNotAvailable();

View File

@ -74,28 +74,6 @@ Copyright (C) 2007 Ashley G Ramdass.
}); });
}); });
zk.afterLoad(function() {
jq(window).on("unload", function () {
//rmDesktop not call in window.onbeforeunload (mount.js) when zk.confirmClose is not null
if (!zk.ie && zk.confirmClose){
rmDesktop();
}
});
//function rmDesktop duplicated from mount.js ( zk.jar 7.0.3 )
function rmDesktop() {
var bRmDesktop = !zk.opera && !zk.keepDesktop;
if (bRmDesktop || zk.pfmeter) {
try {
var dts = zk.Desktop.all;
for (var dtid in dts)
zAu._rmDesktop(dts[dtid], !bRmDesktop);
} catch (e) {
}
}
}
});
zk.afterLoad('zul.inp', function () { zk.afterLoad('zul.inp', function () {
// should filter out for only component inside standard window or component wish fire this event, // should filter out for only component inside standard window or component wish fire this event,