Logging and only one job in the queue
This commit is contained in:
@ -4,7 +4,6 @@ namespace App\Browser\Jobs\Hellcase;
|
|||||||
|
|
||||||
use App\Browser\BrowserJob;
|
use App\Browser\BrowserJob;
|
||||||
use App\Browser\Components\Hellcase\MainNav;
|
use App\Browser\Components\Hellcase\MainNav;
|
||||||
use App\Browser\JobArtifacts\JobRunArtifact;
|
|
||||||
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
|
use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode;
|
||||||
use App\Models\JobArtifact;
|
use App\Models\JobArtifact;
|
||||||
use App\Models\JobRun;
|
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\HellcaseNotificationDailyFree;
|
||||||
use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin;
|
use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin;
|
||||||
use App\Notification\Providers\AllNotification;
|
use App\Notification\Providers\AllNotification;
|
||||||
use Dom\XPath;
|
|
||||||
use Facebook\WebDriver\WebDriverBy;
|
use Facebook\WebDriver\WebDriverBy;
|
||||||
use Illuminate\Support\Facades\Schedule;
|
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Laravel\Dusk\Browser;
|
use Laravel\Dusk\Browser;
|
||||||
|
|
||||||
class HellcaseJob extends BrowserJob
|
class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
|
||||||
{
|
{
|
||||||
private const STEAM_LOGIN_THRESHOLD = 5 * 60; // 5 minutes
|
private const STEAM_LOGIN_THRESHOLD = 5 * 60; // 5 minutes
|
||||||
|
|
||||||
@ -26,11 +25,13 @@ class HellcaseJob extends BrowserJob
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
Log::info("Constructing HellcaseJob");
|
||||||
parent::__construct(2);
|
parent::__construct(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(Browser $browser): ?JobRun
|
public function run(Browser $browser): ?JobRun
|
||||||
{
|
{
|
||||||
|
Log::info("Running HellcaseJob");
|
||||||
$this->jobRun = new JobRun([
|
$this->jobRun = new JobRun([
|
||||||
"job_id" => $this->jobId,
|
"job_id" => $this->jobId,
|
||||||
"success" => false,
|
"success" => false,
|
||||||
@ -48,6 +49,8 @@ class HellcaseJob extends BrowserJob
|
|||||||
$this->jobRun->success = true;
|
$this->jobRun->success = true;
|
||||||
$this->jobRun->save();
|
$this->jobRun->save();
|
||||||
|
|
||||||
|
Log::info("HellcaseJob run ended");
|
||||||
|
|
||||||
return $this->jobRun;
|
return $this->jobRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user