Skip to content

Commit

Permalink
Minor caches fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey18106 committed Jul 19, 2023
1 parent 9d74779 commit b66aa93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/DeployActions/DockerActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function resolveDeployExAppHost(string $appId, DaemonConfig $daemonConfig
}

public function containerStateHealthy(array $containerInfo): bool {
return $containerInfo['State']['Health']['Status'] === 'healthy' && $containerInfo['State']['Status'] === 'running';
return $containerInfo['State']['Status'] === 'running';
}

public function healthcheckContainer(string $containerId, DaemonConfig $daemonConfig): bool {
Expand Down
7 changes: 4 additions & 3 deletions lib/Service/AppEcosystemV2Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ public function getExAppsByPort(int $port): array {
public function enableExApp(ExApp $exApp): bool {
try {
if ($this->exAppMapper->updateExAppEnabled($exApp->getAppid(), true) === 1) {
$cacheKey = '/exApp_' . $exApp->getAppid();
$exApp->setEnabled(1);
$this->cache->set($cacheKey, $exApp, self::CACHE_TTL);

$exAppEnabled = $this->requestToExApp(null, null, $exApp, '/enabled?enabled=1', 'PUT');
if ($exAppEnabled instanceof IResponse) {
$response = json_decode($exAppEnabled->getBody(), true);
Expand All @@ -248,9 +252,6 @@ public function enableExApp(ExApp $exApp): bool {
return false;
}

$cacheKey = '/exApp_' . $exApp->getAppid();
$exApp->setEnabled(1);
$this->cache->set($cacheKey, $exApp, self::CACHE_TTL);
return true;
}
} catch (Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ExAppConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct(
* @return array|null
*/
public function getAppConfigValues(string $appId, array $configKeys): ?array {
$cacheKey = sprintf('/%s:%s', $appId, json_encode($configKeys));
$cacheKey = sprintf('/%s:%s', $appId, join(':', array_values($configKeys)));
$cached = $this->cache->get($cacheKey);
if ($cached !== null) {
return $cached;
Expand Down

0 comments on commit b66aa93

Please sign in to comment.