Skip to content

Commit

Permalink
2023.10.01 Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
monkenWu committed Oct 1, 2023
2 parents cf6afbd + c153eee commit d30a0e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 11 additions & 5 deletions src/Orchestration/Saga/Restarter/Restarter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(?string $orchestratorNumber = null)
public function reStartOrchestratorsByServer(
string $className = null,
$serverName = null,
?bool $isRestart = false,
?bool $reBuild = false,
?string $time = null
): array {
if (is_null($className)) {
Expand All @@ -96,7 +96,7 @@ public function reStartOrchestratorsByServer(
];
continue;
} else {
$this->handleSingleServerRestart($singleServerName, $runtimeOrchArray, $isRestart);
$this->handleSingleServerRestart($singleServerName, $runtimeOrchArray, $reBuild);
}
}
} elseif (is_string($serverName)) {
Expand All @@ -107,7 +107,7 @@ public function reStartOrchestratorsByServer(
"compensateResult" => "編排器名稱 - {$className} 不存在於 {$serverName} 內。"
];
} else {
$this->handleSingleServerRestart($serverName, $runtimeOrchArray, $isRestart);
$this->handleSingleServerRestart($serverName, $runtimeOrchArray, $reBuild);
}
}
return $this->serverRestartResult;
Expand All @@ -118,7 +118,7 @@ public function reStartOrchestratorsByServer(
*/
public function reStartOrchestratorsByClass(
?string $className = null,
?bool $isRestart = false,
?bool $reBuild = false,
?string $time = null
): array {
if (is_null($className)) {
Expand All @@ -127,8 +127,14 @@ public function reStartOrchestratorsByClass(

$serverNameAndRuntimeOrchArray = $this->cacheInstance->getServersOrchestrator($className);

if($serverNameAndRuntimeOrchArray === null) {
return [
"compensateResult" => "找不到編排器名稱 - {$className}"
];
}

foreach ($serverNameAndRuntimeOrchArray as $serverName => $runtimeOrchArray) {
$this->handleSingleServerRestart($serverName, $runtimeOrchArray, $isRestart);
$this->handleSingleServerRestart($serverName, $runtimeOrchArray, $reBuild);
}

return $this->serverRestartResult;
Expand Down
8 changes: 4 additions & 4 deletions src/Orchestration/Saga/Restarter/RestarterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ interface RestarterInterface
*
* @param string|null $className
* @param array|string $serverName
* @param bool|null $isRestart If pass in true in this param, the restarter will restart the runtime orchestrator after compensation.
* @param bool|null $reBuild If pass in true in this param, the restarter will restart the runtime orchestrator after compensation.
* Otherwise, The restarter will only run the compensation for this runtime orchestrator.
* @param string|null $time
* @return array
*/
public function reStartOrchestratorsByServer(
string $className = null,
$serverName = null,
?bool $isRestart = false,
?bool $reBuild = false,
?string $time = null
): array;

/**
* Re-start all same className runtime orchestrator in Redis no matter what the serverName is.
*
* @param string|null $className
* @param boolean|null $isRestart
* @param boolean|null $reBuild
* @param string|null $time
* @return array
*/
public function reStartOrchestratorsByClass(
string $className = null,
?bool $isRestart = false,
?bool $reBuild = false,
?string $time = null
): array;

Expand Down

0 comments on commit d30a0e7

Please sign in to comment.