Rules Scheduler is only running its tasks on cron. But if you don't run cron very frequently (say every 30 minutes) then the scheduling becomes delayed.

For time critical tasks lite sending out tweets, publishing content or emails this deleyed is bad, or it's at least confusing (i.e. #1615472: Scheduled tasks is not executing at scheduled time.).

There are very good reasons for being able to process the rules_scheduler_tasks queue separately. And the best way would of course be via Drush.

The attached patch adds Drush integration for Rules Scheduler with one command that:

  • Adds schedules tasks to the queue
  • Optionally claims and works on tasks for a specified amount of time

Some minor improvements can be made to the patch, like creating a common helper function shared between rules_scheduler_cron() and drush_rules_scheduler_tasks() for adding tasks to the queue. But this is quick and low-impact patch for initial review.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

Title: Drush integration for Rules Scheduler » Drush integration for executing Rules Scheduler tasks
Status: Needs review » Needs work

Great patch - thanks!

+++ b/rules_scheduler/rules_scheduler.drush.inc
@@ -0,0 +1,94 @@
+    'description' => 'Checks for scheduled tasks to be added to the queue.',

Shouldn't those strings use dt() ?

+++ b/rules_scheduler/rules_scheduler.drush.inc
@@ -0,0 +1,94 @@
+      'drush rusch' => 'Add scheduled tasks to the queue.',

rusch - I like ;-)

Some minor improvements can be made to the patch, like creating a common helper function shared between rules_scheduler_cron() and drush_rules_scheduler_tasks() for adding tasks to the queue. But this is quick and low-impact patch for initial review.

Else, patch looks good to me. So let's go ahead and do this small code re-factoring to avoid the duplicated code to become out of sync later on.

dixon_’s picture

Status: Needs work » Needs review
FileSize
4.92 KB
5.14 KB

Shouldn't those strings use dt() ?

Fixed.

Else, patch looks good to me. So let's go ahead and do this small code re-factoring to avoid the duplicated code to become out of sync later on.

Fixed.

greg.1.anderson’s picture

Actually, you don't need dt() in command definitions. Drush calls dt() as needed for these strings.

fago’s picture

Status: Needs review » Fixed

Actually, you don't need dt() in command definitions. Drush calls dt() as needed for these strings.

Indeed, I'm sry for that. So I fixed that and committed it.

Great addition - thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Better wording.