Removing Completed Tasks

I'm new to Rules, and haven't been able to figure this out. I'm sure it's quite obvious, so maybe someone will be able to help.

I have a basic rule that alerts users of a certain role to the creation of a specific content type. Everything works great, except the task doesn't seem to remove itself after the first message is sent. It just sits there in the scheduled task queue. Now it seems that every time cron runs, the original message is resent to the users.

How should I go about removing the task after its been completed the first time through?

(Or have I missed something when setting up the rule that is making it stick around after its been originally executed?)

Groups:
Login to post comments

Got it

silkyD - Fri, 2009-10-02 23:33

Rules is a pretty big module, and sometimes taking a step back can help. I figured out what was going on, and of course, it was quite simple once I got my mind wrapped around what was going on. Hopefully, this will save someone some time.

My situation was this: We had a specific content type that we wanted to allow some privileged users to view before unauthenticated viewers were allowed to read it. The idea was that when the content was saved, an email would go out to the privileged users telling them to take a look. A week after that, the permissions on the node would be changed (via the content access module) so that the content could be available to everyone.

To accomplish this, I scheduled one triggered rule (on saving new content)--that scheduled the permission change, and sent the privileged users a notice. In. That. Order. That's where the problem was. While an email was sent to the selected users and the permission was scheduled correctly, the problem was that the emailing task remained in the schedule queue. Therefore, everytime cron ran, it looked at the task, evalutated whether to change permissions, then sent out another email. The 'send email' action never got cleared from queue because it was presented after the schedule permission change.

Solving this was actually really simple--I split jobs in to two different triggered rules. One sends the email on save. Another schedules the permission change. That's it. Duh! So easy!

I'm not sure if changing the weights of the actions within a single rule would have fixed it--probably--but I didn't try, and this just seems more intuitive to me. But this solution worked quite well. Hope that helps.