Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Jun 1, 2024
1 parent 4965904 commit 4bc9a95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5320,7 +5320,7 @@ function getStatsNotifications($force_recreate = false, $listItIfIsAdminOrOwner
$isLiveEnabled = AVideoPlugin::isEnabledByName('Live');
$cacheHandler = new LiveCacheHandler();
unset($_POST['sort']);
if ($force_recreate) {
if ($force_recreate || !empty($_REQUEST['debug'])) {
if ($isLiveEnabled) {
deleteStatsNotifications();
TimeLogEnd($timeName, __LINE__);
Expand All @@ -5333,7 +5333,9 @@ function getStatsNotifications($force_recreate = false, $listItIfIsAdminOrOwner
}
TimeLogEnd($timeName, __LINE__);
if ($isLiveEnabled) {
//_error_log('getStatsNotifications: 1 ' . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
if(!empty($_REQUEST['debug'])){
_error_log('getStatsNotifications: 1 ' . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
}
$json = Live::getStats();
$json = object_to_array($json);
// make sure all the applications are listed on the same array, even from different live servers
Expand Down
16 changes: 12 additions & 4 deletions plugin/Live/Live.php
Original file line number Diff line number Diff line change
Expand Up @@ -1959,12 +1959,13 @@ public static function getStats($force_recreate = false)
global $getStatsLive, $_getStats, $getStatsObject;
$timeName = "stats.json.php getStats";
TimeLogStart($timeName);
if (empty($force_recreate)) {
if (empty($force_recreate) && empty($_REQUEST['debug'])) {
if (isset($getStatsLive)) {
//_error_log('Live::getStats: return cached result');
return $getStatsLive;
}
}

TimeLogEnd($timeName, __LINE__);
$obj = AVideoPlugin::getObjectData("Live");
if (empty($obj->server_type->value)) {
Expand All @@ -1982,7 +1983,10 @@ public static function getStats($force_recreate = false)
TimeLogEnd($timeName, __LINE__);
return $servers;
} elseif (empty($obj->useLiveServers)) {
//_error_log("Live::getStats empty obj->useLiveServers}");
if(!empty($_REQUEST['debug'])){
_error_log("Live::getStats empty obj->useLiveServers}");;
}
//
//_error_log('getStats getStats 1: ' . ($force_recreate?'force_recreate':'DO NOT force_recreate'));
$getStatsLive = self::_getStats(0, $force_recreate);
TimeLogEnd($timeName, __LINE__);
Expand All @@ -1992,7 +1996,9 @@ public static function getStats($force_recreate = false)
$rows = Live_servers::getAllActive();
TimeLogEnd($timeName, __LINE__);

//_error_log("Live::getStats Live_servers::getAllActive total=" . count($rows));
if(!empty($_REQUEST['debug'])){
_error_log("Live::getStats Live_servers::getAllActive total=" . count($rows));
}
$liveServers = [];
foreach ($rows as $key => $row) {
if (!empty($row['playerServer'])) {
Expand Down Expand Up @@ -2038,7 +2044,9 @@ public static function getStats($force_recreate = false)
}
}
TimeLogEnd($timeName, __LINE__);
//_error_log("Live::getStats return " . json_encode($liveServers));
if(!empty($_REQUEST['debug'])){
_error_log("Live::getStats return " . json_encode($liveServers));;
}
$_REQUEST['live_servers_id'] = $getLiveServersIdRequest;
$getStatsLive = $liveServers;
return $liveServers;
Expand Down

0 comments on commit 4bc9a95

Please sign in to comment.