Skip to content

Commit df9045a

Browse files
author
Joe Bennett
committed
#37139 added support for ext-mongodb <1.3, ^1.3 as well as ^2.0
1 parent a0e4f1f commit df9045a

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/Symfony/Component/Lock/Store/MongoDbStore.php

+1-14
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ class MongoDbStore implements BlockingStoreInterface
5454
private $options;
5555
private $initialTtl;
5656

57-
private $readPreference;
58-
5957
use ExpiringStoreTrait;
6058

6159
/**
@@ -263,7 +261,7 @@ public function exists(Key $key): bool
263261
'$gt' => $this->createMongoDateTime(microtime(true)),
264262
],
265263
], [
266-
'readPreference' => $this->getReadPreference(),
264+
'readPreference' => new ReadPreference(defined(ReadPreference::PRIMARY) ? ReadPreference::PRIMARY : ReadPreference::RP_PRIMARY),
267265
]);
268266
}
269267

@@ -317,17 +315,6 @@ private function isDuplicateKeyException(WriteException $e): bool
317315
return 11000 === $code;
318316
}
319317

320-
private function getReadPreference(): ReadPreference
321-
{
322-
if (null !== $this->readPreference) {
323-
return $this->readPreference;
324-
}
325-
326-
$this->readPreference = new ReadPreference(ReadPreference::RP_PRIMARY);
327-
328-
return $this->readPreference;
329-
}
330-
331318
private function getCollection(): Collection
332319
{
333320
if (null !== $this->collection) {

0 commit comments

Comments
 (0)