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.

Files: 
CommentFileSizeAuthor
#2 rules-scheduler-drush-2.patch5.14 KBdixon_
PASSED: [[SimpleTest]]: [MySQL] 351 pass(es).
[ View ]
#2 interdiff.txt4.92 KBdixon_
rules-scheduler-drush-0.patch3.18 KBdixon_
PASSED: [[SimpleTest]]: [MySQL] 351 pass(es).
[ View ]

Comments

Title:Drush integration for Rules SchedulerDrush 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.

Status:Needs work» Needs review
StatusFileSize
new4.92 KB
new5.14 KB
PASSED: [[SimpleTest]]: [MySQL] 351 pass(es).
[ View ]

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.

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

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.

Issue summary:View changes

Better wording.