Batch API
Batch API can be used to split heavy (user triggered) operations into multiple HTTP requests and show a progress bar to the user while processing happens.
General usage / flow:
- On a form submit call batch_set with a definition array of all operations that should be processed sequetially in multiple requests.
- batch_process will execute all operations and the call a finished-callback (and redirect).
NOTE: batch_process triggers the batch processing. In a form submit it is called for you. If you add a batch with batch_set not with a form submit, you need to call batch_process manually.
Queue API
Queue API can be used to split heavy (cron-triggered) operations into multiple HTTP requests. During each cron run a set of "queue items" (operations) will be processed.
General flow / usage:
- Define cron-triggered queues in hook_cron_queue_info
- Add queue items (operations) in hook_cron. Those items will be processed on the same or multiple cron runs.