Level 1
I solved it, I removedonQueue() and I had forgotten to remove Auth class from my Jobs, After some permission issues I solved it.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm using Redis and Supervisor, Redis is working correctly, And of course, I can see Supervisors's process
redis-cli keys *:
1) "queues:medium"
2) "MyWebsite_cache:u-1-downloaded-file-at"
....
Supervisor Configuration:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/laravel/artisan queue:work
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/laravel/worker.log
Files and permissions:
drwxrwxrwx 12 www-data www-data 4096 Oct 11 02:34 app
-rwxrwxrwx 1 www-data www-data 1686 Oct 2 18:09 artisan
drwxrwxrwx 3 www-data www-data 4096 Oct 2 17:40 bootstrap
-rwxrwxrwx 1 www-data www-data 1814 Oct 19 11:24 composer.json
-rwxrwxrwx 1 www-data www-data 189481 Oct 20 14:39 composer.lock
drwxrwxrwx 2 www-data www-data 4096 Oct 19 09:56 config
drwxrwxrwx 5 www-data www-data 4096 Oct 2 17:40 database
-rwxrwxrwx 1 www-data www-data 1004 Oct 2 17:39 package.json
-rwxrwxrwx 1 www-data www-data 1134 Oct 2 17:39 phpunit.xml
drwxrwxrwx 8 www-data www-data 4096 Oct 12 06:26 public
drwxrwxrwx 5 www-data www-data 4096 Oct 11 05:17 resources
drwxrwxrwx 2 www-data www-data 4096 Oct 2 17:39 routes
-rwxrwxrwx 1 www-data www-data 563 Oct 2 17:39 server.php
drwxrwxrwx 5 www-data www-data 4096 Oct 2 18:50 storage
drwxrwxrwx 4 www-data www-data 4096 Oct 2 17:52 tests
drwxrwxrwx 49 www-data www-data 4096 Oct 20 14:39 vendor
-rwxrwxrwx 1 www-data www-data 1036 Oct 2 17:39 webpack.mix.js
-rwxrwxrwx 1 www-data www-data 0 Oct 21 08:13 worker.log
-rwxrwxrwx 1 www-data www-data 0 Oct 2 17:39 yarn-error.log
My job is something like this
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* The number of seconds the job can run before timing out.
*
* @var int
*/
public $timeout = 300;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 3;
protected $data;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($data)
{
$this->data = $data;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
ini_set('memory_limit', '-1');
$data = $this->data;
// Download File
self::DownloadFile($data);
// Upload File
$uploadedFile = new UploadedFile($data['full_path'], "{$data['name']}.{$data['extension']}", $data['mime-type'], null, true);
Files::saveFile($uploadedFile);
}
// Start Download
static public function DownloadFile($data)
{
set_time_limit(0); // to infinity for example
// This is the file where we save the information
$file_open = fopen($data['full_path'], 'w+');
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, $data['user-agent']); // User-Agent
curl_setopt($ch, CURLOPT_MAXREDIRS, 1); // Maximum of redirection
curl_setopt($ch, CURLOPT_TIMEOUT, 400); // Timeout in Seconds
curl_setopt($ch, CURLOPT_FILE, $file_open); // write curl response to file
curl_setopt($ch, CURLOPT_URL, $data['url']);
// get curl response
curl_exec($ch);
curl_close($ch);
fclose($file_open);
}
And I dispatch it like this
.....
// Start downloading
DownloadFiles::dispatch($data)->onQueue('medium');
return response()->json(['message' => 'Download Started.'], 200);
I don't know what's wrong with this When I'm using Sync driver everything works well but it takes too much time to finish.
I solved it, I removedonQueue() and I had forgotten to remove Auth class from my Jobs, After some permission issues I solved it.
Please or to participate in this conversation.