Running a background task using Symfony Process without having to wait for the process to finish

后端 未结 5 1528
隐瞒了意图╮
隐瞒了意图╮ 2021-02-12 22:30

After a user submits a form, I want to render a view file, and right after that I want to initiate a background task to process five MS Excel files (each may have up to 2000 row

5条回答
  •  忘掉有多难
    2021-02-12 23:11

    I guess what you want is to store the necessary data in a database and then have a cronjob/queue execute the actual command, instead of trying to execute it directly from your controller.

    Add something like the following to your /etc/crontab to let it run your command every 5 minutes

    */5 * * * * root /usr/bin/php /path/to/bin/console hello:world
    

    Then, let your command query the database for the stored data and have it process the excel files

提交回复
热议问题