mirror of
https://github.com/archtechx/jobpipeline.git
synced 2025-12-12 20:54:04 +00:00
leave only shouldBeQueued method
This commit is contained in:
parent
c1e27eae4c
commit
ef4ded6e4e
3 changed files with 8 additions and 53 deletions
|
|
@ -64,61 +64,15 @@ class JobPipeline implements ShouldQueue
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function shouldBeQueued(bool|string $shouldBeQueued = true)
|
||||
{
|
||||
if (is_string($shouldBeQueued))
|
||||
{
|
||||
$this->shouldBeQueuedOn($shouldBeQueued);
|
||||
}
|
||||
else
|
||||
public function shouldBeQueued(bool $shouldBeQueued = true, string $queue = '')
|
||||
{
|
||||
$this->shouldBeQueued = $shouldBeQueued;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function shouldBeQueuedOn(string $queue)
|
||||
{
|
||||
$this->shouldBeQueued = true;
|
||||
|
||||
$this->onQueue($queue);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function onConnection(null|string $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function onQueue(null|string $queue)
|
||||
if ($queue)
|
||||
{
|
||||
$this->queue = $queue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function timeout(int $timeoutInSeconds)
|
||||
{
|
||||
$this->timeout = $timeoutInSeconds;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function delay($delay)
|
||||
{
|
||||
$this->delay = $delay;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function tries(int $tries)
|
||||
{
|
||||
$this->tries = $tries;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class JobPipelineTest extends TestCase
|
|||
FooJob::class,
|
||||
])->send(function () {
|
||||
return $this->valuestore;
|
||||
})->shouldBeQueuedOn('another')
|
||||
})->shouldBeQueued(true, 'another')
|
||||
->toListener());
|
||||
|
||||
$this->assertFalse($this->valuestore->has('foo'));
|
||||
|
|
@ -106,7 +106,7 @@ class JobPipelineTest extends TestCase
|
|||
FooJob::class,
|
||||
])->send(function () {
|
||||
return $this->valuestore;
|
||||
})->shouldBeQueuedOn('another')
|
||||
})->shouldBeQueued(true, 'another')
|
||||
->toListener());
|
||||
|
||||
$this->assertFalse($this->valuestore->has('foo'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
{"foo":"bar"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue