Using the queue and cronjob functionality you can easily offload some longer running tasks into a background process.

Basic Usage

The most common use cases are usually

Email sending (because of gateway timeouts)

Video/image processing (because of memory/timeout issues)

Invoice/PDF/zipfile generation (because of timeout issues)

You don't want the browser to reload forever and eventually the request to die. Instead, you want to quickly give feedback of the task being started and then just inform them again once the job is done.

Give it a try

Let's provide a button to trigger a background job:

This job will take about 20 sek. You can monitor the progress below (you need to reload the page, browser refresh). Note that we prevent it to be run twice while still running.