Better logging in case of error while reposting reel
All checks were successful
Push image to registry / build-image (push) Successful in 4m41s
All checks were successful
Push image to registry / build-image (push) Successful in 4m41s
This commit is contained in:
@ -175,13 +175,8 @@ class InstagramRepostJob extends BrowserJob implements ShouldBeUniqueUntilProces
|
||||
$reel = $infos[0];
|
||||
$videoInfo = $infos[1];
|
||||
|
||||
try {
|
||||
// TODO : Avoid getting the reel from the db again, store it in the downloadedReels array
|
||||
$repostedReelsCounter += $this->repostReel($browser, InstagramRepost::where('reel_id', $reel->reel_id)->first(), $videoInfo);
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to repost reel: {$videoInfo->getTitle()} - " . $e->getMessage());
|
||||
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to repost reel: {$videoInfo->getTitle()} - " . $e->getMessage()));
|
||||
}
|
||||
// TODO : Avoid getting the reel from the db again, store it in the downloadedReels array
|
||||
$repostedReelsCounter += $this->repostReel($browser, InstagramRepost::where('reel_id', $reel->reel_id)->first(), $videoInfo);
|
||||
}
|
||||
|
||||
$this->jobRun->addArtifact(new JobArtifact([
|
||||
@ -346,17 +341,19 @@ class InstagramRepostJob extends BrowserJob implements ShouldBeUniqueUntilProces
|
||||
try {
|
||||
$browser->waitForText("Your post was shared", 60, true);
|
||||
$closeButton = $browser->driver->findElement(WebDriverBy::xpath('//div[./div/*[local-name() = "svg"][@aria-label="Close"]]'));
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to repost reel: {$reel->reel_id} - " . $e->getMessage());
|
||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to repost reel: {$reel->reel_id} - " . $e->getMessage()));
|
||||
$closeButton->click();
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true; // Reel reposted successfully, no error message found
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to repost reel: {$reel->reel_id} - " . $e->getMessage());
|
||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to repost reel: {$reel->reel_id} - " . $e->getMessage()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user