drupal-batch-queue-cron

Implement Drupal background processing with Batch API, QueueWorker plugins, and hook_cron.

1|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/proofoftom/drupal-skills --skill drupal-batch-queue-cron
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drupal-batch-queue-cron
Source: https://github.com/proofoftom/drupal-skills/tree/main/skills/drupal-batch-queue-cron
Command: npx skills add https://github.com/proofoftom/drupal-skills --skill drupal-batch-queue-cron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the handling of large datasets and periodic tasks by leveraging Drupal's Batch API, Queue Workers, and cron hooks, preventing timeouts and ensuring efficient background processing.

Core Features & Use Cases

  • Batch Processing: Handle multi-request operations for large user-initiated tasks.
  • Queue Workers: Process items asynchronously during cron runs with time-based execution.
  • Cron Hooks: Execute bounded, periodic tasks efficiently.
  • Use Case: Automatically process thousands of user-uploaded images in batches, or run a nightly cleanup of old log entries via cron.

Quick Start

Use the drupal-batch-queue-cron skill to create a QueueWorker that processes items from a queue named 'my_data_processor' and runs for up to 15 seconds during cron.

Frequently Asked Questions about drupal-batch-queue-cron

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I process large datasets in Drupal without timing out?

To process large datasets in Drupal without timing out, use the Batch API for multi-request operations or Queue Workers for asynchronous background processing during cron. This splits heavy work into chunks, preventing request timeouts and managing large datasets efficiently.

How does Drupal QueueWorker handle scheduled tasks during cron?

Drupal QueueWorker handles scheduled tasks by processing queue items asynchronously during cron runs with time-based execution limits. This ensures bounded operations, running periodic tasks for a set duration like 15 seconds before yielding control back to the system.

Can I use Drupal Batch API for user-initiated tasks and Queue API for cron separately?

Yes, you can separate user-initiated tasks and cron tasks. Use the Drupal Batch API for multi-request operations triggered by users, and use the Queue API with QueueWorker plugins for background tasks processed during scheduled cron runs.

What is the best way to run periodic cleanup tasks in Drupal?

The best way to run periodic cleanup tasks in Drupal is by implementing hook_cron for bounded, scheduled tasks. For heavier cleanup, defer items to a Queue Worker to process asynchronously during cron without exceeding execution time limits.

Does Drupal Queue API support RequeueException for failed background processing?

Yes, the Drupal Queue API supports RequeueException handling to re-queue items that fail during background processing. It also utilizes the Lock API to ensure exclusive operations, preventing duplicate processing of scheduled tasks across concurrent cron runs.