Laravel的工作会覆盖其他工作吗? [英] Laravel job overwriting other jobs?

查看:95
本文介绍了Laravel的工作会覆盖其他工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不太确定如何写这个单词,但是我有一个名为uploadFile的工作,该工作使用CloudConvert将上传的文件(例如PDF)转换为JPG.

I'm not too sure how to word this one, but I've got a job called uploadFile, which uses CloudConvert to convert an uploaded file (e.g PDF) to a JPG.

单独使用,效果很好.我可以上传文件,将其保存到S3,然后CloudConvert获取S3文件,将其转换并也上传它.完美的.

Used in isolation, it all works great. I can upload a file, it'll be saved to S3, then CloudConvert gets the S3 file, converts it and uploads that too. Perfect.

一次被多个人使用时,文件混合在一起.文件名是正确的(因此变量本身必须是正确的),但是处理的实际图像是其他人的某种方式.

When it's being used by more than one person at a time, the files get mixed up. The filenames are correct (so the variables themselves must be correct), but the actual image processed is someone else's somehow.

$originalFileName = str_replace('.'.$this->extension, '', $this->actualFileName);
$tempName = $originalFileName.'_'.time().'.jpg';
$fileName = $originalFileName.'_'.time();

Storage::disk('s3')->put($folder.$fileName, $file, 'public');

$fileUrl = Storage::disk('s3')->url($fileName);

CloudConvert::file($fileUrl)
    ->withOptions([
        'quality' => 80,
        'resize' => '400x400',
    ])->to(CloudConvert::S3($tempName));

在上面,在Storage->put()中的文件是正确的,在$tempName$fileName中也是正确的.不知何故,它正在转换的文件是错误的,因此输出Jpeg来自其他人的上传.

In the above, the file in Storage->put() is correct, as is $tempName and $fileName. Somehow, the file it's converting is wrong, so the output Jpeg is from someone else's upload.

有人对我可以尝试的方法有任何想法吗?我什至不知道从哪里开始调试.

Does anyone have any idea of what I can try? I'm not even sure where to begin debugging that.

推荐答案

嗯,好的,我终于解决了. CloudConvert需要重新实例化.如果有人再次遇到此问题,请参见线程此处.

Eugh, okay I finally worked it out. CloudConvert needed to be reinstantiated. See thread here, if anyone ever encounters this again.

这篇关于Laravel的工作会覆盖其他工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆