I've made a job
for destroying a file:
class DestroyFile implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
/**
* @var File
*/
protected $file;
/**
* DestroyFile constructor.
* @param File $file
*/
public function __construct(File $file)
{
$this->file = $file;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$path = $this->file->getPath();
if(Storage::disk('s3')->exists($path))
{
Storage::disk('s3')->delete($path);
if(!Storage::disk('s3')->exists($path))
{
$attachment = File::find($this->file->id);
$attachment->delete();
}
}
}
}
I fire the job like this:
dispatch(new DestroyFile($file));
Locally this is working but on forge it's not. I'm already using queues with forge for sending emails and they work fine.
So what could be going on here (I already restarted the queue)?
I'm using Beanstalkd
and Laravel 5.3