dqmg80654 2019-02-14 06:15
浏览 877

maxAttemptsExceededException:Laravel Jobs因最大尝试次数或超时而失败

I have checked the questions asked before but did not find the solution I need. Here is the question list, Laravel & Laravel Forge returns “MaxAttemptsExceededException:” even when tries are set at 1, Asynchronous Laravel Jobs, Laravel job overwriting other jobs?

What I'm trying is to convert all the videos(Maybe in MBs or GBs) with the help of FFMPEG using the Laravel jobs on the button click event.

Without using the Job, the code is working properly.

Here is the code Sample of Controller,

public function uploadSelected(Request $request)
{
    $input = $request->all();
    $ids = explode(',', $input['ids']);
    $this->dispatch(new FTPConverting($ids, 0));
    return redirect()->to('videos/ftp-videos');
}

And in the job, the handle is like this

public function handle()
{
    foreach ($this->videos as $id) {
        if (file_exists(storage_path('app/public/temp_videos/' . $id))) {
            copy(storage_path('app/public/temp_videos/' . $id), storage_path('app/public/temp_videos/uploaded/' . $id));
            $video = TempVideo::create([
                        'original_name' => $id,
                        'disk' => 'public',
                        'video_path' => 'temp_videos/uploaded/' . $id
            ]);
            $this->video_without_watermark($video->video_path, $video->id, $video->disk);
            $this->streaming_without_watermark($video->video_path, $video->id, $video->disk);
            if ($video->upload_status == 'Converted') {
                unlink(storage_path('app/public/temp_videos/' . $id));
                unlink(storage_path('app/public/temp_videos/uploaded/' . $id));
            }
        }
    }
}

In the functions, video_without_watermark and streaming_without_watermark, there is the logic to convert files with the help of FFMPEG.

Please let me know what I'm doing wrong or possible solution to this.

Edit The log of the failed job table

Illuminate\Queue\MaxAttemptsExceededException: App\Jobs\FTPConverting has been attempted too many times or run too long. The job may have previously timed out. in /var/www/html/screwbox/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:401

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值