Skip to content

Commit

Permalink
[8.x] Fix DynamoDB locks with 0 seconds duration (#43365)
Browse files Browse the repository at this point in the history
* Fix DynamoDB locks with 0 seconds duration

* Update DynamoDbLock.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
lukaszmtw and taylorotwell authored Jul 22, 2022
1 parent 96aecce commit 9d0dfff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Cache/DynamoDbLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ public function __construct(DynamoDbStore $dynamo, $name, $seconds, $owner = nul
*/
public function acquire()
{
return $this->dynamo->add(
$this->name, $this->owner, $this->seconds
);
if ($this->seconds > 0) {
return $this->dynamo->add($this->name, $this->owner, $this->seconds);
} else {
return $this->dynamo->add($this->name, $this->owner, 86400);
}
}

/**
Expand Down

0 comments on commit 9d0dfff

Please sign in to comment.