4 Commits

Author SHA1 Message Date
70cd2a41b1 Do not throw exception if we don't have daily free
All checks were successful
Push image to registry / build-image (push) Successful in 4m42s
2025-06-05 16:35:05 +02:00
d498203147 Added debug messages 2025-06-05 16:31:23 +02:00
69fdad8f4e Do not get duplicates when finlling with non posted reels 2025-06-05 16:28:35 +02:00
982f4ca7a7 JobDebug notification are error by default 2025-06-04 16:23:56 +02:00
3 changed files with 13 additions and 3 deletions

View File

@ -226,7 +226,11 @@ class HellcaseJob extends BrowserJob implements ShouldBeUniqueUntilProcessing
private function getDailyFree(Browser $browser)
{
$browser->visit('https://hellcase.com/dailyfree');
$browser->waitForText("Get Daily free loot", 30, true);
try {
$browser->waitForText("Get Daily free loot", 30, true);
} catch (\Exception $e) {
return; // Pobably means we do not have access to a daily free loot
}
// Do we fill the conditions ?
if (sizeof(value: $browser->driver->findElements(WebDriverBy::xpath('//p[contains(text(), "Fulfill the conditions below")]'))) > 0) {

View File

@ -127,8 +127,13 @@ class InstagramRepostJob extends BrowserJob implements ShouldBeUniqueUntilProces
// Add unreposted reels to the job run if not enough reels were downloaded
if (count($toDownloadReels) < self::MAX_REPOSTS_PER_JOB) {
$toDownloadReelsIds = array_map(function ($reel) {
return $reel->reel_id;
}, $toDownloadReels);
$unrepostedReels = InstagramRepost::where("reposted", false)
->where("repost_tries", "<", self::MAX_REPOST_TRIES) // Limit to 3 tries
->whereNotIn("reel_id", $toDownloadReelsIds) // Avoid already downloaded reels
->whereIn("account_id", InstagramAccount::whereIn("username", $accounts)->pluck("id"))
->take(self::MAX_REPOSTS_PER_JOB - count($toDownloadReels))
->get();
@ -184,7 +189,8 @@ class InstagramRepostJob extends BrowserJob implements ShouldBeUniqueUntilProces
"content" => ""
]));
} catch (\Exception $e) {
dump($e->getMessage());
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
AllNotification::send(new JobDebugNotification($this->jobId, "Unknown error when trying to repost reels : " . $e->getMessage()));
} finally {
// Removes all videos in the download folder
$files = glob($this->downloadFolder . '*'); // Get all files in the download folder

View File

@ -14,7 +14,7 @@ class JobDebugNotification extends Notification {
private string|null $title;
private string|null $screenShotProjectPath;
public function __construct(int $jobId, string $body, string $title = null, string $error = null, ?string $screenshotProjectPath = "", bool $isError = false) {
public function __construct(int $jobId, string $body, string $title = null, string $error = null, ?string $screenshotProjectPath = "", bool $isError = true) {
parent::__construct($jobId, isError:$isError);
$this->title = $title;
if ($screenshotProjectPath === "") {