mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
* Admin: push server test to diagnose problems and improved recovery from failed requests / network problems
This commit is contained in:
parent
f07303b321
commit
7db25dce5e
@ -132,6 +132,10 @@ class admin_hooks
|
|||||||
{
|
{
|
||||||
$file['phpInfo'] = "javascript:egw.openPopup('" . Egw::link('/admin/phpinfo.php','',false) . "',960,600,'phpinfoWindow')";
|
$file['phpInfo'] = "javascript:egw.openPopup('" . Egw::link('/admin/phpinfo.php','',false) . "',960,600,'phpinfoWindow')";
|
||||||
}
|
}
|
||||||
|
if (file_exists(EGW_SERVER_ROOT.'/swoolepush/test.php'))
|
||||||
|
{
|
||||||
|
$file['Test Push'] = Egw::link('/swoolepush/test.php');
|
||||||
|
}
|
||||||
$file['Admin queue and history'] = Egw::link('/index.php','menuaction=admin.admin_cmds.index&ajax=true');
|
$file['Admin queue and history'] = Egw::link('/index.php','menuaction=admin.admin_cmds.index&ajax=true');
|
||||||
$file['Remote administration instances'] = Egw::link('/index.php','menuaction=admin.admin_cmds.remotes&ajax=true');
|
$file['Remote administration instances'] = Egw::link('/index.php','menuaction=admin.admin_cmds.remotes&ajax=true');
|
||||||
$file['Custom translation'] = Egw::link('/index.php','menuaction=admin.admin_customtranslation.index');
|
$file['Custom translation'] = Egw::link('/index.php','menuaction=admin.admin_customtranslation.index');
|
||||||
|
@ -112,7 +112,6 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
this.websocket = new WebSocket(url);
|
this.websocket = new WebSocket(url);
|
||||||
this.websocket.onopen = jQuery.proxy(function(e)
|
this.websocket.onopen = jQuery.proxy(function(e)
|
||||||
{
|
{
|
||||||
reconnect_time = min_reconnect_time;
|
|
||||||
this.websocket.send(JSON.stringify({
|
this.websocket.send(JSON.stringify({
|
||||||
subscribe: tokens,
|
subscribe: tokens,
|
||||||
account_id: parseInt(account_id)
|
account_id: parseInt(account_id)
|
||||||
@ -121,6 +120,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
|
|
||||||
this.websocket.onmessage = jQuery.proxy(function(event)
|
this.websocket.onmessage = jQuery.proxy(function(event)
|
||||||
{
|
{
|
||||||
|
reconnect_time = min_reconnect_time;
|
||||||
console.log(event);
|
console.log(event);
|
||||||
let data = JSON.parse(event.data);
|
let data = JSON.parse(event.data);
|
||||||
if (data && data.type)
|
if (data && data.type)
|
||||||
@ -131,6 +131,9 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
|
|
||||||
this.websocket.onerror = jQuery.proxy(function(error)
|
this.websocket.onerror = jQuery.proxy(function(error)
|
||||||
{
|
{
|
||||||
|
reconnect_time *= 2;
|
||||||
|
if (reconnect_time > max_reconnect_time) reconnect_time = max_reconnect_time;
|
||||||
|
|
||||||
console.log(error);
|
console.log(error);
|
||||||
(error||this.handleError({}, error));
|
(error||this.handleError({}, error));
|
||||||
}, this);
|
}, this);
|
||||||
@ -139,6 +142,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
{
|
{
|
||||||
if (event.wasClean)
|
if (event.wasClean)
|
||||||
{
|
{
|
||||||
|
reconnect_time = min_reconnect_time;
|
||||||
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
|
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -117,11 +117,12 @@ class Push extends Msg
|
|||||||
/**
|
/**
|
||||||
* Check and if neccessary set push backend
|
* Check and if neccessary set push backend
|
||||||
*
|
*
|
||||||
|
* @param boolean $ignore_cache =false
|
||||||
* @throws Exception\NotOnline
|
* @throws Exception\NotOnline
|
||||||
*/
|
*/
|
||||||
protected static function checkSetBackend()
|
protected static function checkSetBackend($ignore_cache=false)
|
||||||
{
|
{
|
||||||
if (!isset(self::$backend))
|
if ($ignore_cache || !isset(self::$backend))
|
||||||
{
|
{
|
||||||
// we prepend so the default backend stays last
|
// we prepend so the default backend stays last
|
||||||
foreach(Api\Hooks::process('push-backends', [], true) as $class)
|
foreach(Api\Hooks::process('push-backends', [], true) as $class)
|
||||||
@ -156,12 +157,13 @@ class Push extends Msg
|
|||||||
/**
|
/**
|
||||||
* Check if only fallback / no real push available
|
* Check if only fallback / no real push available
|
||||||
*
|
*
|
||||||
|
* @param boolean $ignore_cache =false
|
||||||
* @return bool true: fallback, false: real push
|
* @return bool true: fallback, false: real push
|
||||||
*/
|
*/
|
||||||
public static function onlyFallback()
|
public static function onlyFallback($ignore_cache=false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
self::checkSetBackend();
|
self::checkSetBackend($ignore_cache);
|
||||||
}
|
}
|
||||||
catch (\Exception $e) {
|
catch (\Exception $e) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user