66
77use Clegginabox \Airlock \Notifier \AirlockNotifierInterface ;
88use Clegginabox \Airlock \Queue \QueueInterface ;
9- use Clegginabox \Airlock \Seal \RefreshableSeal ;
109use Clegginabox \Airlock \Seal \ReleasableSeal ;
1110use Clegginabox \Airlock \Seal \Seal ;
1211use Clegginabox \Airlock \Seal \SealToken ;
1312
14- final readonly class QueueAirlock implements AirlockInterface
13+ final readonly class QueueAirlock implements Airlock, ReleasingAirlock
1514{
1615 public function __construct (
17- private Seal &ReleasableSeal & RefreshableSeal $ seal ,
16+ private Seal &ReleasableSeal $ seal ,
1817 private QueueInterface $ queue ,
1918 private AirlockNotifierInterface $ notifier ,
2019 private string $ topicPrefix = '/waiting-room ' ,
@@ -29,7 +28,7 @@ public function enter(string $identifier, int $priority = 0): EntryResult
2928 $ position = $ this ->queue ->add ($ identifier , $ priority );
3029
3130 // 2. Are we at the front of the line? (Position 1)
32- if ($ position > 1 ) {
31+ if ($ position !== 1 ) {
3332 // No? Wait your turn.
3433 return EntryResult::queued ($ position , $ this ->topicFor ($ identifier ));
3534 }
@@ -67,11 +66,6 @@ public function release(SealToken $token): void
6766 $ this ->notifier ->notify ($ nextPassenger , $ this ->topicFor ($ nextPassenger ));
6867 }
6968
70- public function refresh (SealToken $ token , ?float $ ttlInSeconds = null ): SealToken
71- {
72- return $ this ->seal ->refresh ($ token , $ ttlInSeconds );
73- }
74-
7569 public function getPosition (string $ identifier ): ?int
7670 {
7771 return $ this ->queue ->getPosition ($ identifier );
0 commit comments