Pint
This commit is contained in:
@@ -7,12 +7,12 @@ use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class GetFileSizeFromCDN implements ShouldQueue
|
||||
{
|
||||
@@ -35,8 +35,9 @@ class GetFileSizeFromCDN implements ShouldQueue
|
||||
{
|
||||
// Retrieve the download record, return if not found
|
||||
$download = Downloads::find($this->downloadId);
|
||||
if (!$download) {
|
||||
if (! $download) {
|
||||
Log::error("Download not found for ID: {$this->downloadId}");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ class GetFileSizeFromCDN implements ShouldQueue
|
||||
|
||||
try {
|
||||
// Send HTTP request to the endpoint
|
||||
$response = Http::get($endpoint . '/getSize/' . $file . '/' . $expire);
|
||||
$response = Http::get($endpoint.'/getSize/'.$file.'/'.$expire);
|
||||
|
||||
// Check if response is successful
|
||||
if ($response->successful()) {
|
||||
@@ -67,9 +68,9 @@ class GetFileSizeFromCDN implements ShouldQueue
|
||||
Log::error("Failed to retrieve size for download ID: {$this->downloadId}, HTTP status: {$response->status()}");
|
||||
}
|
||||
} catch (RequestException $e) {
|
||||
Log::error("HTTP request failed for download ID: {$this->downloadId}, error: " . $e->getMessage());
|
||||
Log::error("HTTP request failed for download ID: {$this->downloadId}, error: ".$e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
Log::error("An error occurred for download ID: {$this->downloadId}, error: " . $e->getMessage());
|
||||
Log::error("An error occurred for download ID: {$this->downloadId}, error: ".$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user