@@ -25,15 +25,15 @@ public function __construct(
2525 private readonly RR \LockInterface $ lock ,
2626 private readonly TokenGeneratorInterface $ tokens = new RandomTokenGenerator (),
2727 private readonly float $ initialTtl = 300.0 ,
28- private readonly float $ initialWaitTtl = 60 ,
28+ private readonly float $ initialWaitTtl = 0 ,
2929 ) {
3030 \assert ($ this ->initialTtl >= 0 );
3131 \assert ($ this ->initialWaitTtl >= 0 );
3232 }
3333
34- public function withTtl (float $ ttl ): self
34+ public function withTtl (float $ ttl, float $ waitTtl = 0 ): self
3535 {
36- return new self ($ this ->lock , $ this ->tokens , $ ttl , $ this -> initialWaitTtl );
36+ return new self ($ this ->lock , $ this ->tokens , $ ttl , $ waitTtl );
3737 }
3838
3939 public function save (Key $ key ): void
@@ -46,7 +46,7 @@ public function save(Key $key): void
4646 /** @var non-empty-string $resource */
4747 $ resource = (string )$ key ;
4848
49- $ status = $ this ->lock ->lock ($ resource , $ lockId , $ this ->initialTtl );
49+ $ status = $ this ->lock ->lock ($ resource , $ lockId , $ this ->initialTtl , $ this -> initialWaitTtl );
5050
5151 if (false === $ status ) {
5252 throw new LockConflictedException ('RoadRunner. Failed to make lock ' );
@@ -65,7 +65,7 @@ public function saveRead(Key $key): void
6565
6666 /** @var non-empty-string $resource */
6767 $ resource = (string )$ key ;
68- $ status = $ this ->lock ->lockRead ($ resource , $ lockId , $ this ->initialTtl );
68+ $ status = $ this ->lock ->lockRead ($ resource , $ lockId , $ this ->initialTtl , $ this -> initialWaitTtl );
6969
7070 if (false === $ status ) {
7171 throw new LockConflictedException ('RoadRunner. Failed to make read lock ' );
0 commit comments