Logging and only one job in the queue

This commit is contained in:
2025-02-21 18:34:03 +01:00
parent 750bcf13b4
commit a4d52e3f88

View File

@ -4,7 +4,6 @@ namespace App\Browser\Jobs\Hellcase;
use App\Browser\BrowserJob;
use App\Browser\Components\Hellcase\MainNav;
use App\Browser\JobArtifacts\JobRunArtifact;
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
use App\Models\JobArtifact;
use App\Models\JobRun;
@ -13,12 +12,12 @@ use App\Notification\NotificationBody\Hellcase\HellcaseNotificationLoginBody;
use App\Notification\Notifications\Hellcase\HellcaseNotificationDailyFree;
use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin;
use App\Notification\Providers\AllNotification;
use Dom\XPath;
use Facebook\WebDriver\WebDriverBy;
use Illuminate\Support\Facades\Schedule;
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
use Illuminate\Support\Facades\Log;
use Laravel\Dusk\Browser;
class HellcaseJob extends BrowserJob
class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
{
private const STEAM_LOGIN_THRESHOLD = 5 * 60; // 5 minutes
@ -26,11 +25,13 @@ class HellcaseJob extends BrowserJob
public function __construct()
{
Log::info("Constructing HellcaseJob");
parent::__construct(2);
}
public function run(Browser $browser): ?JobRun
{
Log::info("Running HellcaseJob");
$this->jobRun = new JobRun([
"job_id" => $this->jobId,
"success" => false,
@ -48,6 +49,8 @@ class HellcaseJob extends BrowserJob
$this->jobRun->success = true;
$this->jobRun->save();
Log::info("HellcaseJob run ended");
return $this->jobRun;
}