Codeigniter or PHP Queue (queue)

Asked

Viewed 214 times

1

I’m doing a massive upload of files to a photo server.

It happens that until sending all the photos, the user ends up waiting a long time. Then they gave me the tip to search about queue or Queue. In this way, the user could leave the uploads page and do other things on the system, while behind PHP would send.

In Codeigniter, I found nothing about it. Does anyone know how to do via PHP or Codeigniter a task queue?

  • I know how to work that upload without bothering the user or giving refresh page. But if you want to change page while doing the upload (is what it looks like), so I think you and I will have to research further. The problem is that even in asynchronous requests, you will need the JavaScript and of form memory-laden (browser), and changing page doesn’t seem like a good idea because the whole business recharges. I’ve seen things like server side upload in php, and I believe it is possible, because of CGI, but I’ve never ventured. As I said, it depends on (a lot) research.

1 answer

0


Staff at Laravel there is a cron function that keeps working on the backstage, as if it were the cronjob of linux.

Turns out I didn’t find this on Codeigniter, what I did was very simple:

1- I created a cronjobs table; 2- When uploading the photos to the system, it saves in cronjobs a task that is to launch to the other server slowly; 3- I set a cronjob that beats from time to time in this script, which analyzes the pending cronjobs and makes the upload.

The business became so cool that I am using for several other functions, in which the user does not need to wait (example triggering simple emails through the system, generation of heavier reports, etc).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.