Parcourir la source

Bug fix + wyłączenie usuwania wyników poszukiwań z bazy w przypadku wystąpienia błędu

Mariusz Muszyński il y a 8 ans
Parent
commit
19312d2dc4
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 6 2
      SE/se-lib/Route/UrlAction/BiAuditGenerate.php

+ 6 - 2
SE/se-lib/Route/UrlAction/BiAuditGenerate.php

@@ -1173,7 +1173,7 @@ Router::getRoute("UrlAction_BiAuditGenerate")->' . $function . ';
 						'FILE_STATUS' => 'ERROR',
 						'FILE_STATUS_info' => $error,
 					];
-					self::deleteResultsFromDB($row['ID']);
+					//self::deleteResultsFromDB($row['ID']);
 					//if (file_exists($xmlFile)) unlink($xmlFile);
 				} elseif ($success) {
 					$sqlArr = [
@@ -2236,6 +2236,7 @@ class BiAuditPowiazania {
 		'details' => [],
 	];
 	private $lastProgress = 0;
+	private $lastProgress_slowCheck = 0;
 	private $lastResults = 0;
 	private $startTimestamp = null;
 	private $lastTimestamp = null;
@@ -2368,6 +2369,7 @@ class BiAuditPowiazania {
 				$this->itemID = DB::getPDO()->fetchValue("select `REMOTE_ID` from `BI_audit_ALL` where `ID` = :ID", [":ID" => $row['ID']]);
 				$this->startTimestamp = microtime(true);
 				$this->lastProgress = 0;
+				$this->lastProgress_slowCheck = 0;
 				$this->saveProgress(['progress' => 0, 'message' => "Wyszukiwanie powiązań dla obiektu {$this->i}/{$this->count}"]);
 				if ($this->maxDepth != $this->origMaxDepth) {
 					$this->maxDepth = $this->origMaxDepth;
@@ -2417,14 +2419,16 @@ class BiAuditPowiazania {
 
 	public function findPowiazania($ID, $progress = 0, $steps = 1, $relation = "") {
 		if (((++$this->step) % 1000000) == 0) {
-			$progressDiff = $progress - $this->lastProgress;
+			$progressDiff = $progress - $this->lastProgress_slowCheck;
 			if ($progressDiff < 0.00005) {
 				$this->lowProgressCount++;
 				if ($this->lowProgressCount == 10) {
 					$this->maxDepth--;
 					self::saveToLog("Zbyt dużo rekurencji, zmniejszono maksymalną głębokość poszukiwań do {$this->maxDepth} dla bieżącego obiektu");
+					$this->lowProgressCount = 0;
 				}
 			} else $this->lowProgressCount = 0;
+			$this->lastProgress_slowCheck = $progress;
 		}
 
 		if ((($this->step) % 100000) == 0) {