Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
class DoctrineDbalPostgreSqlStore implements BlockingSharedLockStoreInterface, BlockingStoreInterface
{
private Connection $conn;
private static array $storeRegistry = [];

/**
* You can either pass an existing database connection a Doctrine DBAL Connection
Expand Down Expand Up @@ -278,8 +277,8 @@ private function filterDsn(#[\SensitiveParameter] string $dsn): string

private function getInternalStore(): SharedLockStoreInterface
{
$namespace = spl_object_hash($this->conn);
static $storeRegistry = new \WeakMap();

return self::$storeRegistry[$namespace] ??= new InMemoryStore();
return $storeRegistry[$this->conn] ??= new InMemoryStore();
}
}
5 changes: 2 additions & 3 deletions src/Symfony/Component/Lock/Store/PostgreSqlStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class PostgreSqlStore implements BlockingSharedLockStoreInterface, BlockingStore
private ?string $username = null;
private ?string $password = null;
private array $connectionOptions = [];
private static array $storeRegistry = [];

/**
* You can either pass an existing database connection as PDO instance or
Expand Down Expand Up @@ -283,8 +282,8 @@ private function checkDriver(): void

private function getInternalStore(): SharedLockStoreInterface
{
$namespace = spl_object_hash($this->getConnection());
static $storeRegistry = new \WeakMap();

return self::$storeRegistry[$namespace] ??= new InMemoryStore();
return $storeRegistry[$this->getConnection()] ??= new InMemoryStore();
}
}
Loading