feat: randomly sleep between executions
This commit is contained in:
parent
ff8d8371ad
commit
e0289e2949
1 changed files with 3 additions and 2 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Sleep;
|
||||||
|
|
||||||
class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||||
{
|
{
|
||||||
|
|
@ -37,10 +38,10 @@ public function __construct(public Server $server)
|
||||||
$this->handle();
|
$this->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
// ray("checking container statuses for {$this->server->id}");
|
$rand = rand(1, 15);
|
||||||
|
Sleep::for($rand)->seconds();
|
||||||
try {
|
try {
|
||||||
if (!$this->server->isServerReady()) {
|
if (!$this->server->isServerReady()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue