feat: randomly sleep between executions

This commit is contained in:
Andras Bacsai 2023-12-13 12:35:56 +01:00
parent ff8d8371ad
commit e0289e2949

View File

@ -17,6 +17,7 @@
use Illuminate\Queue\Middleware\WithoutOverlapping;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Arr;
use Illuminate\Support\Sleep;
class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
{
@ -37,10 +38,10 @@ public function __construct(public Server $server)
$this->handle();
}
public function handle()
{
// ray("checking container statuses for {$this->server->id}");
$rand = rand(1, 15);
Sleep::for($rand)->seconds();
try {
if (!$this->server->isServerReady()) {
return;