Samir Sabri
Samir Sabri

Reputation: 977

How to execute heavy task?

I need to parse a big excel file and convert it into json format, however, I got this error when I tried to do so:

Maximum execution time of 60 seconds exceeded

What is the right way to handle this? What I like to do is to upload the excel file, then the user will see a waiting animation, until the parsing is done.

Also, if the user refreshed the page, he would see the waiting animation if the parsing is not done yet at the server side.

How would I break the task into sub tasks, and manage them till they all executed? what's the right way to do so in Laravel 5?

Upvotes: 0

Views: 121

Answers (1)

darthmaim
darthmaim

Reputation: 5148

The right way to handle long running jobs in Laravel is to use Queues.

When the user uploads the excel file, you can push a new job processing the file to the queue and it gets executed in the background.

Upvotes: 1

Related Questions