|
14 | 14 | use Doctrine\DBAL\Types\Type;
|
15 | 15 | use Doctrine\DBAL\Types\Types;
|
16 | 16 | use Neos\ContentRepository\Core\Infrastructure\DbalSchemaDiff;
|
| 17 | +use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; |
17 | 18 | use Neos\ContentRepository\Core\Subscription\Store\SubscriptionCriteria;
|
18 | 19 | use Neos\ContentRepository\Core\Subscription\Store\SubscriptionStoreInterface;
|
19 | 20 | use Neos\ContentRepository\Core\Subscription\Subscription;
|
|
31 | 32 | final class DoctrineSubscriptionStore implements SubscriptionStoreInterface
|
32 | 33 | {
|
33 | 34 | public function __construct(
|
34 |
| - private string $tableName, |
| 35 | + private readonly ContentRepositoryId $contentRepositoryId, |
| 36 | + private readonly string $tableName, |
35 | 37 | private readonly Connection $dbal,
|
36 | 38 | private readonly ClockInterface $clock,
|
37 | 39 | ) {
|
@@ -167,17 +169,18 @@ private static function fromDatabase(array $row): Subscription
|
167 | 169 | public function acquireLock(): void
|
168 | 170 | {
|
169 | 171 | // todo fully implement https://github.com/patchlevel/event-sourcing/blob/caaf54fcf32c0e42b1036a5c7ff77c1a37af0105/src/Store/DoctrineDbalStore.php#L456
|
170 |
| - $result = $this->dbal->fetchOne(sprintf('SELECT GET_LOCK("%s", %d)', 'default', 0)); |
| 172 | + // todo check if 16 chars (crID) is a good lock value? |
| 173 | + $result = $this->dbal->fetchOne(sprintf('SELECT GET_LOCK("%s", %d)', $this->contentRepositoryId->value, 0)); |
171 | 174 | if ($result !== 1) {
|
172 |
| - throw new \RuntimeException('failed to acquire lock'); |
| 175 | + throw new \RuntimeException('Failed to acquire lock for subscriptions.', 1733135506); |
173 | 176 | }
|
174 | 177 | }
|
175 | 178 |
|
176 | 179 | public function releaseLock(): void
|
177 | 180 | {
|
178 |
| - $result = $this->dbal->fetchOne(sprintf('SELECT RELEASE_LOCK("%s")', 'default')); |
| 181 | + $result = $this->dbal->fetchOne(sprintf('SELECT RELEASE_LOCK("%s")', $this->contentRepositoryId->value)); |
179 | 182 | if ($result !== 1) {
|
180 |
| - throw new \RuntimeException('failed to release lock'); |
| 183 | + throw new \RuntimeException('Failed to release lock for subscriptions.', 1733135506); |
181 | 184 | }
|
182 | 185 | }
|
183 | 186 |
|
|
0 commit comments