Skip to content

Commit

Permalink
Missed a few bits of priority in the burner.
Browse files Browse the repository at this point in the history
Specifically, pass the priority through to `publish_another()`. Done by
adding a `priority` attribute to the burner class.
  • Loading branch information
theory committed Jul 29, 2010
1 parent 2682853 commit 9da2dde
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
3 changes: 2 additions & 1 deletion lib/Bric/Changes.pod
Expand Up @@ -24,7 +24,8 @@ L<bric_soap> and L<bric_republish>. Sponsored by Denison University. [David]
Added a C<$priority> argument to the C<publish> method of Added a C<$priority> argument to the C<publish> method of
L<Bric::Util::Burner> and modifed L<Bric::Util::Job::Pub> to pass its L<Bric::Util::Burner> and modifed L<Bric::Util::Job::Pub> to pass its
priority. This is so that the priority of the publish job will be replicated priority. This is so that the priority of the publish job will be replicated
as the priority of the distribution job created by the publish. [David] as the priority of the distribution job created by the publish, as well as of
any publish jobs created by calls to C<publish_another()>. [David]


=item * =item *


Expand Down
28 changes: 19 additions & 9 deletions lib/Bric/Util/Burner.pm
Expand Up @@ -276,6 +276,7 @@ BEGIN {
base_uri => Bric::FIELD_READ, base_uri => Bric::FIELD_READ,
burn_again => Bric::FIELD_RDWR, burn_again => Bric::FIELD_RDWR,
resources => Bric::FIELD_READ, resources => Bric::FIELD_READ,
priority => Bric::FIELD_READ,


# Private Fields # Private Fields
_page_extensions => Bric::FIELD_NONE, _page_extensions => Bric::FIELD_NONE,
Expand Down Expand Up @@ -372,6 +373,7 @@ sub new {
$init->{_page_extensions} ||= ['']; $init->{_page_extensions} ||= [''];
$init->{_notes} = {}; $init->{_notes} = {};
$init->{resources} = []; $init->{resources} = [];
$init->{priority} ||= 3;
$init->{_output_preview_msgs} = 1 $init->{_output_preview_msgs} = 1
unless defined $init->{_output_preview_msgs}; unless defined $init->{_output_preview_msgs};


Expand Down Expand Up @@ -496,14 +498,14 @@ sub flush_another_queue {
my $class = shift; my $class = shift;
return $class unless @another_queue_uuids; return $class unless @another_queue_uuids;
while (my $uuid = shift @another_queue_uuids) { while (my $uuid = shift @another_queue_uuids) {
my ($doc, $pub_time, $notes) = @{ $another_queue{$uuid} }; my ($doc, $pub_time, $notes, $priority) = @{ $another_queue{$uuid} };
my $key = $doc->key_name; my $key = $doc->key_name;
Bric::Util::Job::Pub->new({ Bric::Util::Job::Pub->new({
sched_time => $pub_time, sched_time => $pub_time,
user_id => get_user_id(), user_id => get_user_id(),
name => 'Publish "' . $doc->get_name . '"', name => 'Publish "' . $doc->get_name . '"',
"$key\_instance_id" => $doc->get_version_id, "$key\_instance_id" => $doc->get_version_id,
priority => $doc->get_priority, priority => $priority,
notes => $notes, notes => $notes,
})->save; })->save;
} }
Expand Down Expand Up @@ -1260,11 +1262,14 @@ sub publish {
my $repub = $ba->get_publish_status; my $repub = $ba->get_publish_status;


# Mark the story as published, so that other stories published by # Mark the story as published, so that other stories published by
# burn_another() can find it as published in the database. # publish_another() can find it as published in the database.
$ba->set_publish_date($publish_date); $ba->set_publish_date($publish_date);
$ba->set_publish_status(1) unless $repub; $ba->set_publish_status(1) unless $repub;
$ba->save; $ba->save;
$self->_set([qw(mode _republish)], [PUBLISH_MODE, $repub]); $self->_set(
[qw(mode _republish priority)],
[PUBLISH_MODE, $repub, $priority || $ba->get_priority]
);


# Determine if we've published before. Set the expire date if we haven't. # Determine if we've published before. Set the expire date if we haven't.
my $exp_date = $ba->get_expire_date(ISO_8601_FORMAT); my $exp_date = $ba->get_expire_date(ISO_8601_FORMAT);
Expand Down Expand Up @@ -1326,7 +1331,7 @@ sub publish {
name => $name, name => $name,
server_types => $bat, server_types => $bat,
"$key\_instance_id" => $ba->get_version_id, "$key\_instance_id" => $ba->get_version_id,
priority => $priority || $ba->get_priority, priority => $self->get_priority,
}); });


# Burn, baby, burn! # Burn, baby, burn!
Expand Down Expand Up @@ -1421,7 +1426,7 @@ sub publish {
log_event($key . ($repub ? '_republish' : '_publish'), $ba); log_event($key . ($repub ? '_republish' : '_publish'), $ba);
} }


$self->_set([qw(mode _republish)], [undef, undef]); $self->_set([qw(mode _republish priority)], [undef, undef, 3]);
return $published; return $published;
} }


Expand Down Expand Up @@ -1496,7 +1501,7 @@ sub publish_another {
throw_burn_error( throw_burn_error(
error => qq{Cannot publish $key "$uri" because it is checked out. } error => qq{Cannot publish $key "$uri" because it is checked out. }
. 'Your best bet is to pass `published_version => 1` when ' . 'Your best bet is to pass `published_version => 1` when '
. 'looking up documents to pass to burn_another()', . 'looking up documents to pass to publish_another()',
mode => $self->get_mode, mode => $self->get_mode,
); );
} }
Expand Down Expand Up @@ -1526,7 +1531,12 @@ sub publish_another {
} else { } else {
# Add it to the publish_another queue. # Add it to the publish_another queue.
push @another_queue_uuids, $uuid; push @another_queue_uuids, $uuid;
$another_queue{$uuid} = [ $ba, $pub_time, [ $self->_get('_notes') ] ]; $another_queue{$uuid} = [
$ba,
$pub_time,
[ $self->_get('_notes') ],
$self->get_priority,
];
} }
return $self; return $self;
} }
Expand Down Expand Up @@ -2264,7 +2274,7 @@ sub _expire {
name => $expname, name => $expname,
resources => $res, resources => $res,
type => 1, type => 1,
priority => $ba->get_priority, priority => $self->get_priority,
$ba->key_name . '_instance_id' => $ba->get_version_id, $ba->key_name . '_instance_id' => $ba->get_version_id,
}); });
$exp_job->save; $exp_job->save;
Expand Down

0 comments on commit 9da2dde

Please sign in to comment.