After a scheduled transition executes, a notice log entry is created (type: content) for the transition on every cron run, rapidly filling the log with notices for transitions that have already occurred. For example, a scheduled unpublishing of a blog post will trigger a notice log entry on the date/time it is unpublished, but then every time cron runs after that a new notice is generated for the already unpublished node.

Is there a way to stop this?

CommentFileSizeAuthor
#6 workflow-scheduled-transition-log-entries-repeating-1357406-6.patch993 bytesAnonymous (not verified)

Comments

douglasmiller’s picture

Priority: Normal » Critical

I am seeing this is my logs as well. Here is a SQL query that I ran to show me all entries for a particular node in a day:

select message,type, from_unixtime(timestamp) from watchdog where type='content' and message like '%scheduled transition%' and link like '%member-thank-you%' and day(from_unixtime(timestamp)) = 30 order by timestamp desc;

and this is the result:

+----------------------------------------+---------+--------------------------+
| message                                | type    | from_unixtime(timestamp) |
+----------------------------------------+---------+--------------------------+
| %type: scheduled transition of %title. | content | 2012-01-30 09:30:52      | 
| %type: scheduled transition of %title. | content | 2012-01-30 09:20:13      | 
| %type: scheduled transition of %title. | content | 2012-01-30 09:16:23      | 
| %type: scheduled transition of %title. | content | 2012-01-30 09:02:27      | 
| %type: scheduled transition of %title. | content | 2012-01-30 08:49:47      | 
| %type: scheduled transition of %title. | content | 2012-01-30 08:41:13      | 
| %type: scheduled transition of %title. | content | 2012-01-30 08:31:27      | 
| %type: scheduled transition of %title. | content | 2012-01-30 08:21:12      | 
| %type: scheduled transition of %title. | content | 2012-01-30 08:15:52      | 
| %type: scheduled transition of %title. | content | 2012-01-30 08:01:15      | 
| %type: scheduled transition of %title. | content | 2012-01-30 07:45:36      | 
| %type: scheduled transition of %title. | content | 2012-01-30 07:40:07      | 
| %type: scheduled transition of %title. | content | 2012-01-30 07:30:26      | 
| %type: scheduled transition of %title. | content | 2012-01-30 07:20:06      | 
| %type: scheduled transition of %title. | content | 2012-01-30 07:15:27      | 
| %type: scheduled transition of %title. | content | 2012-01-30 07:01:08      | 
| %type: scheduled transition of %title. | content | 2012-01-30 06:45:21      | 
| %type: scheduled transition of %title. | content | 2012-01-30 06:40:14      | 
| %type: scheduled transition of %title. | content | 2012-01-30 06:30:31      | 
| %type: scheduled transition of %title. | content | 2012-01-30 06:20:05      | 
| %type: scheduled transition of %title. | content | 2012-01-30 06:15:26      | 
| %type: scheduled transition of %title. | content | 2012-01-30 06:01:07      | 
| %type: scheduled transition of %title. | content | 2012-01-30 05:45:23      | 
| %type: scheduled transition of %title. | content | 2012-01-30 05:40:12      | 
| %type: scheduled transition of %title. | content | 2012-01-30 05:30:37      | 
| %type: scheduled transition of %title. | content | 2012-01-30 05:20:04      | 
| %type: scheduled transition of %title. | content | 2012-01-30 05:15:29      | 
| %type: scheduled transition of %title. | content | 2012-01-30 05:01:07      | 
| %type: scheduled transition of %title. | content | 2012-01-30 04:45:28      | 
| %type: scheduled transition of %title. | content | 2012-01-30 04:40:10      | 
| %type: scheduled transition of %title. | content | 2012-01-30 04:30:26      | 
| %type: scheduled transition of %title. | content | 2012-01-30 04:20:06      | 
| %type: scheduled transition of %title. | content | 2012-01-30 04:15:25      | 
| %type: scheduled transition of %title. | content | 2012-01-30 04:01:07      | 
| %type: scheduled transition of %title. | content | 2012-01-30 03:45:25      | 
| %type: scheduled transition of %title. | content | 2012-01-30 03:40:09      | 
| %type: scheduled transition of %title. | content | 2012-01-30 03:30:31      | 
| %type: scheduled transition of %title. | content | 2012-01-30 03:20:09      | 
| %type: scheduled transition of %title. | content | 2012-01-30 03:15:24      | 
| %type: scheduled transition of %title. | content | 2012-01-30 03:01:06      | 
| %type: scheduled transition of %title. | content | 2012-01-30 02:45:21      | 
| %type: scheduled transition of %title. | content | 2012-01-30 02:40:08      | 
| %type: scheduled transition of %title. | content | 2012-01-30 02:30:28      | 
| %type: scheduled transition of %title. | content | 2012-01-30 02:20:04      | 
| %type: scheduled transition of %title. | content | 2012-01-30 02:15:24      | 
| %type: scheduled transition of %title. | content | 2012-01-30 02:01:08      | 
| %type: scheduled transition of %title. | content | 2012-01-30 01:45:22      | 
| %type: scheduled transition of %title. | content | 2012-01-30 01:40:07      | 
| %type: scheduled transition of %title. | content | 2012-01-30 01:30:27      | 
| %type: scheduled transition of %title. | content | 2012-01-30 01:20:08      | 
| %type: scheduled transition of %title. | content | 2012-01-30 01:15:25      | 
| %type: scheduled transition of %title. | content | 2012-01-30 01:01:17      | 
| %type: scheduled transition of %title. | content | 2012-01-30 00:45:22      | 
| %type: scheduled transition of %title. | content | 2012-01-30 00:40:07      | 
| %type: scheduled transition of %title. | content | 2012-01-30 00:30:30      | 
| %type: scheduled transition of %title. | content | 2012-01-30 00:20:10      | 
| %type: scheduled transition of %title. | content | 2012-01-30 00:15:27      | 
| %type: scheduled transition of %title. | content | 2012-01-30 00:01:16      | 
+----------------------------------------+---------+--------------------------+

Anonymous’s picture

Also on 7.x-1.2+20-dev

johnv’s picture

Version: 6.x-1.5 » 7.x-1.x-dev
Anonymous’s picture

I noticed that one case that this happened was when I accidentally scheduled node to change to it's current state. Maybe that shouldn't be possible at all? :)

johnv’s picture

@pikku-h , perhaps you can test the following:

In function workflow_execute_transition(), the transition is not executed in a not-allowed situation, for instance when old_sid = new_sid.
The last lines of that function are:

  // Clear any references in the scheduled listing.
  workflow_delete_workflow_scheduled_transition_by_nid($node->nid);

Perhaps this line must be repeated in all/some of the not-allowed situations.

Anonymous’s picture

@johnv, indeed adding workflow_delete_workflow_scheduled_transition_by_nid() to other cases than successful scheduling is needed.

Attached is a patch that removes scheduling if node is scheduled to change state that is the same the node currently is (ie. changing state draft -> draft). Fixed also that scheduling comment is still added to node scheduling history.

johnv’s picture

Status: Active » Needs review

Thanks for the patch.
Do you have an opinion about the other not-allowed situations?

Anonymous’s picture

I don't have time to go through those ATM but I guess that all of them should be clearing any scheduled transitions. Otherwise this just happens again at next cron run.

It also might be good idea to move these validations from workflow_execute_transition() to for example workflow_tab_form_validate(). This way there would not be "invalid" schedulings.

johnv’s picture

Title: scheduled transition log entries repeating every time cron runs » Cron Scheduling keeps repeating if Old state and New state are the same.
Category: support » bug
Priority: Critical » Normal
Status: Needs review » Fixed

We'll just leave the other exceptions untouched for now. They might be configuration errors in a live site, that must be corrected by admin.

The patch is committed here.

chicagomom’s picture

Thank you!

Status: Fixed » Closed (fixed)

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