Skip to content

Commit

Permalink
Merge pull request #5 from msmakouz/docs
Browse files Browse the repository at this point in the history
Fix documentation links
  • Loading branch information
butschster authored Feb 19, 2024
2 parents 774864e + edb7432 commit f339abf
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ jobs:
with:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2']
stability: >-
['prefer-stable']
2 changes: 0 additions & 2 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ jobs:
with:
os: >-
['ubuntu-latest']
php: >-
['8.1']
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[![Latest Stable Version](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/v/stable)](https://packagist.org/packages/roadrunner-php/symfony-lock-driver)
[![phpunit](https://github.com/roadrunner-php/symfony-lock-driver/actions/workflows/phpunit.yml/badge.svg)](https://github.com/roadrunner-php/symfony-lock-driver/actions)
[![psalm](https://github.com/roadrunner-php/symfony-lock-driver/actions/workflows/psalm.yml/badge.svg)](https://github.com/roadrunner-php/symfony-lock-driver/actions)
[![Codecov](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/branch/master/graph/badge.svg)](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/)
[![Codecov](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/branch/1.x/graph/badge.svg)](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/)
[![Total Downloads](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/downloads)](https://packagist.org/roadrunner-php/symfony-lock-driver/phpunit)
<a href="https://discord.gg/8bZsjYhVVk"><img src="https://img.shields.io/badge/discord-chat-magenta.svg"></a>

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"email": "[email protected]"
}
],
"homepage": "https://spiral.dev/",
"homepage": "https://roadrunner.dev",
"support": {
"docs": "https://roadrunner.dev/docs",
"docs": "https://docs.roadrunner.dev",
"issues": "https://github.com/roadrunner-server/roadrunner/issues",
"forum": "https://forum.roadrunner.dev/",
"chat": "https://discord.gg/V6EK4he"
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src"/>
Expand Down
5 changes: 2 additions & 3 deletions src/RoadRunnerStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Symfony\Component\Lock\BlockingStoreInterface;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\LockReleasingException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\SharedLockStoreInterface;
use Symfony\Component\Lock\Store\ExpiringStoreTrait;
Expand Down Expand Up @@ -122,8 +121,8 @@ public function waitAndSave(Key $key): void
$status = $this->lock->lock($resource, $lockId, $this->initialTtl, $this->initialWaitTtl);

$key->setState(__CLASS__, $lockId);
if (!$status) {
throw new LockConflictedException();
if ($status === false) {
throw new LockConflictedException('RoadRunner. Failed to make lock');
}

$this->checkNotExpired($key);
Expand Down
29 changes: 29 additions & 0 deletions tests/RoadRunnerStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,33 @@ public function testDeleteFail(): void
$key->setState(RoadRunnerStore::class, 'lock-id');
$store->delete($key);
}

public function testWaitAndSaveSuccess(): void
{
$this->rrLock->expects($this->once())
->method('lock')
->with('resource-name', 'random-id', 300, 60)
->willReturn('lock-id');

$store = new RoadRunnerStore($this->rrLock, $this->tokens);
$key = new Key('resource-name');
$store->waitAndSave($key);

$this->assertTrue($key->hasState(RoadRunnerStore::class));
$this->assertSame('random-id', $key->getState(RoadRunnerStore::class));
}

public function testWaitAndSaveFail(): void
{
$this->expectException(LockConflictedException::class);
$this->expectExceptionMessage('RoadRunner. Failed to make lock');

$this->rrLock->expects($this->once())
->method('lock')
->with('resource-name', 'random-id', 300, 60)
->willReturn(false);

$store = new RoadRunnerStore($this->rrLock, $this->tokens);
$store->waitAndSave(new Key('resource-name'));
}
}

0 comments on commit f339abf

Please sign in to comment.