Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Aug 22, 2019
1 parent a29221c commit 8d817dc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Mutex/Mutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ public function lock(string $id, string $token): Promise

return $this->std->eval(self::TOKEN, ["lock:{$id}"], [$token, $this->ttl]);
} finally {
$hash = spl_object_hash($connection);
$hash = \spl_object_hash($connection);
$key = $this->busyConnectionMap[$hash] ?? null;
unset($this->busyConnections[$key], $this->busyConnectionMap[$hash]);
$this->readyConnections[] = [time(), $connection];
$this->readyConnections[] = [\time(), $connection];
}
});
}
Expand Down Expand Up @@ -261,11 +261,11 @@ public function getTimeout(): int
*/
protected function getReadyConnection(): Client
{
$connection = array_pop($this->readyConnections);
$connection = \array_pop($this->readyConnections);
$connection = $connection[1] ?? null;

if (!$connection) {
if ($this->maxConnections && count($this->busyConnections) + 1 === $this->maxConnections) {
if ($this->maxConnections && \count($this->busyConnections) + 1 === $this->maxConnections) {
throw new ConnectionLimitException;
}

Expand All @@ -275,10 +275,10 @@ protected function getReadyConnection(): Client
}

$this->busyConnections[] = $connection;
end($this->busyConnections);
\end($this->busyConnections);

$hash = spl_object_hash($connection);
$this->busyConnectionMap[$hash] = key($this->busyConnections);
$hash = \spl_object_hash($connection);
$this->busyConnectionMap[$hash] = \key($this->busyConnections);

return $connection;
}
Expand Down

0 comments on commit 8d817dc

Please sign in to comment.