8000 [Lock] Fix wrong interface for MongoDbStore by jderusse · Pull Request #38134 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Lock] Fix wrong interface for MongoDbStore #38134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2020
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
5 changes: 5 additions & 0 deletions UPGRADE-5.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ FrameworkBundle
used to be added by default to the seed, which is not the case anymore. This allows sharing caches between
apps or different environments.

Lock
----

* `MongoDbStore` does not implement `BlockingStoreInterface` anymore, typehint against `PersistingStoreInterface` instead.

Mime
----

Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Lock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

5.2.0
-----

* `MongoDbStore` does not implement `BlockingStoreInterface` anymore, typehint against `PersistingStoreInterface` instead.

5.1.0
-----

Expand Down
13 changes: 2 additions & 11 deletions src/Symfony/Component/Lock/Store/MongoDbStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
use MongoDB\Exception\DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException as MongoInvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
use Symfony\Component\Lock\BlockingStoreInterface;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\InvalidTtlException;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\LockExpiredException;
use Symfony\Component\Lock\Exception\LockStorageException;
use Symfony\Component\Lock\Exception\NotSupportedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;

/**
* MongoDbStore is a StoreInterface implementation using MongoDB as a storage
Expand All @@ -46,7 +45,7 @@
*
* @author Joe Bennett <joe@assimtech.com>
*/
class MongoDbStore implements BlockingStoreInterface
class MongoDbStore implements PersistingStoreInterface
{
private $collection;
private $client;
Expand Down Expand Up @@ -224,14 +223,6 @@ public function save(Key $key)
$this->checkNotExpired($key);
}

/**
* {@inheritdoc}
*/
public function waitAndSave(Key $key)
{
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', __CLASS__));
}

/**
* {@inheritdoc}
*
Expand Down
12 changes: 0 additions & 12 deletions src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use MongoDB\Client;
use MongoDB\Driver\Exception\ConnectionTimeoutException;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\NotSupportedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\Store\MongoDbStore;
Expand Down Expand Up @@ -81,17 +80,6 @@ public function testCreateIndex()
$this->assertContains('expires_at_1', $indexes);
}

public function testNonBlocking()
{
$this->expectException(NotSupportedException::class);

$store = $this->getStore();

$key = new Key(uniqid(__METHOD__, true));

$store->waitAndSave($key);
}

/**
* @dataProvider provideConstructorArgs
*/
Expand Down
0