Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to return to user, and perform computation in the background
  • I'm making an app in which the user uploads gps data which is saved into the database.
    The file to be uploaded is big, and it takes a while for the server to finish all tasks..
    I would like to know if there is a way for my program to return a view to the user  immediately after the upload (so that he can continue with his user experience), and perform the subsequent calculations and DB operations afterwards (the user does not care about them, so why make him wait)...
  • HarroHarro
    Accepted Answer
    Normally you would use a queue mechanism, and a queue processor you can run via a task and a cron job so it can run server side in the background.

    For example something like https://bitbucket.org/codeyellow/queue if you want something simple.

    Note that you have to look carefully at your design. Since things will be processed asynchroniously, your frontend code can no longer make assumptions on the state of your data, so you need to track that. The user may not care, but some application functions might...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion