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];
|
$reel = $infos[0];
|
||||||
$videoInfo = $infos[1];
|
$videoInfo = $infos[1];
|
||||||
|
|
||||||
try {
|
// TODO : Avoid getting the reel from the db again, store it in the downloadedReels array
|
||||||
// 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);
|
||||||
$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()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->jobRun->addArtifact(new JobArtifact([
|
$this->jobRun->addArtifact(new JobArtifact([
|
||||||
@ -346,17 +341,19 @@ class InstagramRepostJob extends BrowserJob implements ShouldBeUniqueUntilProces
|
|||||||
try {
|
try {
|
||||||
$browser->waitForText("Your post was shared", 60, true);
|
$browser->waitForText("Your post was shared", 60, true);
|
||||||
$closeButton = $browser->driver->findElement(WebDriverBy::xpath('//div[./div/*[local-name() = "svg"][@aria-label="Close"]]'));
|
$closeButton = $browser->driver->findElement(WebDriverBy::xpath('//div[./div/*[local-name() = "svg"][@aria-label="Close"]]'));
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Failed to repost reel: {$reel->reel_id} - " . $e->getMessage());
|
Log::error("Failed to repost reel: {$reel->reel_id} - " . $e->getMessage());
|
||||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||||
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to repost reel: {$reel->reel_id} - " . $e->getMessage()));
|
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to repost reel: {$reel->reel_id} - " . $e->getMessage()));
|
||||||
$closeButton->click();
|
$closeButton->click();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true; // Reel reposted successfully, no error message found
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user