Explorar el Código

Ombi on homepage causes site to hang (#1107)

causefx hace 7 años
padre
commit
dfc0ba86ab

+ 2 - 1
api/config/default.php

@@ -210,5 +210,6 @@ return array(
 	'rememberMe' => true,
 	'plexStrictFriends' => true,
 	'debugAreaAuth' => '1',
-	'commit' => 'n/a'
+	'commit' => 'n/a',
+	'ombiLimit' => '50'
 );

+ 3 - 3
api/functions/homepage-connect-functions.php

@@ -49,7 +49,7 @@ function homepageConnect($array)
 			return getCalendar();
 			break;
 		case 'getRequests':
-			return getOmbiRequests();
+			return getOmbiRequests($GLOBALS['ombiLimit']);
 			break;
 		default:
 			# code...
@@ -1971,7 +1971,7 @@ function ombiAction($id, $action, $type, $fullArray = null)
 	return isset($success['ok']) ? $success : false;
 }
 
-function getOmbiRequests($type = "both")
+function getOmbiRequests($type = "both", $limit = 50)
 {
 	if ($GLOBALS['homepageOmbiEnabled'] && !empty($GLOBALS['ombiURL']) && !empty($GLOBALS['ombiToken']) && qualifyRequest($GLOBALS['homepageOmbiAuth'])) {
 		$url = qualifyURL($GLOBALS['ombiURL']);
@@ -2066,7 +2066,7 @@ function getOmbiRequests($type = "both")
 			writeLog('error', 'OMBI Connect Function - Error: ' . $e->getMessage(), 'SYSTEM');
 		};
 	}
-	$api['content'] = isset($requests) ? $requests : false;
+	$api['content'] = isset($requests) ? array_slice($requests, 0, $limit) : false;
 	return $api;
 }
 

+ 6 - 0
api/functions/homepage-functions.php

@@ -2008,6 +2008,12 @@ function getHomepageList()
 						'label' => 'Limit to User',
 						'value' => $GLOBALS['ombiLimitUser']
 					),
+					array(
+						'type' => 'number',
+						'name' => 'ombiLimit',
+						'label' => 'Item Limit',
+						'value' => $GLOBALS['ombiLimit'],
+					),
 					array(
 						'type' => 'select',
 						'name' => 'ombiRefresh',