Update
This commit is contained in:
@@ -16,6 +16,8 @@ class ProcessCrawlShotJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $timeout = 120;
|
||||
|
||||
protected string $jobUuid;
|
||||
|
||||
public function __construct(string $jobUuid)
|
||||
@@ -26,7 +28,7 @@ public function __construct(string $jobUuid)
|
||||
public function handle(): void
|
||||
{
|
||||
$job = CrawlShotJob::where('uuid', $this->jobUuid)->first();
|
||||
|
||||
|
||||
if (!$job) {
|
||||
Log::error("CrawlShotJob not found: {$this->jobUuid}");
|
||||
return;
|
||||
@@ -52,10 +54,9 @@ public function handle(): void
|
||||
'status' => 'completed',
|
||||
'completed_at' => now()
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Job {$this->jobUuid} failed: " . $e->getMessage());
|
||||
|
||||
|
||||
$job->update([
|
||||
'status' => 'failed',
|
||||
'error_message' => $e->getMessage(),
|
||||
@@ -68,9 +69,9 @@ private function saveCrawlResult(CrawlShotJob $job, string $html): void
|
||||
{
|
||||
$filename = "{$job->uuid}.html";
|
||||
$path = "crawlshot/html/{$filename}";
|
||||
|
||||
|
||||
Storage::put($path, $html);
|
||||
|
||||
|
||||
$job->update(['file_path' => $path]);
|
||||
}
|
||||
|
||||
@@ -80,9 +81,9 @@ private function saveScreenshotResult(CrawlShotJob $job, array $result): void
|
||||
$format = $parameters['format'] ?? 'jpg';
|
||||
$filename = "{$job->uuid}.{$format}";
|
||||
$path = "crawlshot/images/{$filename}";
|
||||
|
||||
|
||||
Storage::put($path, $result['data']);
|
||||
|
||||
|
||||
$job->update(['file_path' => $path]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
*/
|
||||
|
||||
'waits' => [
|
||||
'redis:default' => 60,
|
||||
'redis:default' => 120,
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -189,9 +189,9 @@
|
||||
'maxProcesses' => 1,
|
||||
'maxTime' => 0,
|
||||
'maxJobs' => 0,
|
||||
'memory' => 128,
|
||||
'memory' => 4096,
|
||||
'tries' => 1,
|
||||
'timeout' => 60,
|
||||
'timeout' => 120,
|
||||
'nice' => 0,
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user