Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
Fix worker stalls
  • Loading branch information
cyberpower678 committed Feb 10, 2024
1 parent fbc3584 commit cfa04a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions app/src/Core/APII.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ public function __construct( $page, $pageid, $config, $cachedContent = false ) {
* @copyright Copyright (c) 2015-2024, Maximilian Doerr, Internet Archive
* @author Maximilian Doerr (Cyberpower678)
*/
public static function getBatchText( $objects, $objectType = 'pagetitle', &$returnedObjects = [],
$handleTruncation = true
public static function getBatchText( $objects, $objectType = 'pagetitle', &$unhandledObjects = [],
$handleLimitations = true
) {
$returnArray = [];

Expand Down Expand Up @@ -310,9 +310,14 @@ public static function getBatchText( $objects, $objectType = 'pagetitle', &$retu
}
}

$diff = count( $batch ) - count( $objects );

if( isset( $limit ) ) $batch = array_slice( $objects, 0, $limit );
else $batch = $objects;

$unhandledObjects = $objects;

$returnedObjects = $objects;
if( !$handleLimitations && $diff !== 0 ) break;
}

return $returnArray;
Expand Down
2 changes: 1 addition & 1 deletion app/src/Core/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ public static function generateLogReport() {
public function logScanResults( $urlID, $isDead, $ip, $hostname, $httpCode, $curlInfo, $error = '' ) {
$sql =
"INSERT INTO " . SECONDARYDB . ".externallinks_scan_log (`url_id`,`scanned_dead`,`host_machine`,`external_ip`,`reported_code`,`reported_error`,`request_data`) VALUES ( $urlID," .
( is_null( $isDead ) ? 2 : (int)(bool)$isDead ) . ", '$hostname', '$ip', $httpCode, " . ( empty( $error
( is_null( $isDead ) ? 2 : (int)(bool)$isDead ) . ", '$hostname', '$ip', " . ( is_null( $httpCode ) ? 0 : $httpCode ) . ", " . ( empty( $error
) ? "NULL" : "'$error'" ) .
", '" .
mysqli_escape_string( self::$db, serialize( $curlInfo ) ) . "' );";
Expand Down

0 comments on commit cfa04a5

Please sign in to comment.