Records don't get removed from scheduler DB table

henrrrik - May 4, 2009 - 11:23
Project:Scheduler
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

in scheduler_cron() the following line is never true because $n is the loaded node object. It should be looking at the database result object $node.

    if (isset($n->unpublish_on) && $n->unpublish_on == 0) {

Should be:

    if (isset($node->unpublish_on) && $node->unpublish_on == 0) {

This causes scheduler to fail to delete any records.

#1

Eric Schaefer - May 4, 2009 - 16:32

$n get loaded via node_load() which results in scheduler_nodeapi($op=='load') which adds the publish_on and unpublish_on fields to the node if they exist.
I just tested it and it work just fine. Node was published and row in {scheduler} was removed.

Do the entries in {scheduler} in your database not get deleted?

#2

henrrrik - May 5, 2009 - 08:18
Version:6.x-1.3» 5.x-1.9
Status:active» postponed

You are indeed correct. Our scheduler table currently has 150+ rows, so it hasn't deleted any records for a while. Very peculiar, I'll investigate further.

#3

henrrrik - May 5, 2009 - 08:27
Status:postponed» active

I'm starting to suspect the editors on the site... If you schedule something for publishing and then publish it manually before scheduler kicks in, it never gets removed from the {scheduler} table as far as I can tell.

#4

Eric Schaefer - May 5, 2009 - 13:49

Maybe we should check the table once in a while for abandoned nodes that can be removed...

#5

henrrrik - May 5, 2009 - 18:15

I suppose records could be automatically purged if they

a) reference published nodes with an outdated publish_on timestamp and no unpublish date, or
b) reference unpublished nodes with an outdated unpublish_on date.

That way the table is kept tidy regardless of what the users get up to.

#6

jonathan1055 - May 6, 2009 - 18:16

We could probably include some code in scheduler_nodeapi such that when a node is published manually then we check if there was a row in {scheduler} and update it or delete it (whichever is appropriate depending on whether there is also an unpublish date set). This would fix the problem immediately instead of writing something to periodically tidy up the table.

Jonathan

#7

Eric Schaefer - May 11, 2009 - 17:29
Status:active» needs review

The logic should be pretty easy. Patch attached.

AttachmentSize
scheduler6_dead_rows.patch 1.07 KB

#8

Eric Schaefer - May 11, 2009 - 17:32

Wrong. New patch...

AttachmentSize
scheduler6_dead_rows.patch 1.07 KB

#9

Eric Schaefer - May 12, 2009 - 12:49
Title:Records don't get removed form scheduler DB table» Records don't get removed from scheduler DB table
Version:5.x-1.9» 6.x-1.x-dev

#10

Eric Schaefer - July 11, 2009 - 17:00
Status:needs review» fixed

Since nobody reported any problem with this patch I assume it is OK. => http://drupal.org/cvs?commit=236078

I don't know if the problem is for real anyways. If you try to manually publish a scheduled node it will not be published if you do not clear the publish_on field. In this case the scheduler table entry will get deleted anyways...

#11

System Message - July 25, 2009 - 17:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.