The cron system in Drupal has been modified to accommodate tasks that need to be run regularly, but that may not complete within a normal page load. This is accomplished using the hook_cron_queue_info
hook. Cron also now ensures that cron is not canceled if the PHP time limit is reached while cron is executing.
hook_cron_queue_info()
This hook allows you to define processes that need to be executed by Drupal in the background rather than being executed immediately during the cron run. To define these processes, you will create and return an associative array with the following values:
worker
callback
—the callback that should be executed when the queue is runtime
—the maximum amount of time that should be spent executing the callback per cron run
The callback will receive an item definition that includes a unique item_id
, the time
the item was created, an expire
key indicating the time when the item expires, and optionally, user data
that can be added to the...