-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Laravel
-
None
https://github.com/mongodb/laravel-mongodb/issues/2609
- Laravel-mongodb Version: #.#.#
- PHP Version: #.#.#
- Database Driver & Version:
Description:
I have issue when store data to cache lock with MongoDB driver. error also occurs when dispatch a job implements ShouldBeUnique.
Method acquire Illuminate\Cache\DatabaseLock catch QueryException to update record cache lock table. But with mongodb driver connection throw MongoDB\Driver\Exception\BulkWriteException so can not excute snippet code in catch block
Illuminate\Cache\DatabaseLock
public function acquire() { $acquired = false; try { $this->connection->table($this->table)->insert([ 'key' => $this->name, 'owner' => $this->owner, 'expiration' => $this->expiresAt(), ]); $acquired = true; } catch (QueryException $e) { $updated = $this->connection->table($this->table) ->where('key', $this->name) ->where(function ($query) { return $query->where('owner', $this->owner)->orWhere('expiration', '<=', time()); })->update([ 'owner' => $this->owner, 'expiration' => $this->expiresAt(), ]); $acquired = $updated >= 1; } if (random_int(1, $this->lottery[1]) <= $this->lottery[0]) { $this->connection->table($this->table)->where('expiration', '<=', time())->delete(); } return $acquired; }
- has to be done after
-
PHPORM-87 Update and fix queue feature
- Closed
- is duplicated by
-
PHPORM-141 laravel-mongodb - Issue #2718: Need to support upsert function in Laravel 10
- Closed
- is related to
-
PHPORM-141 laravel-mongodb - Issue #2718: Need to support upsert function in Laravel 10
- Closed