Skip to content
Browse files

Missed a few bits of priority in the burner.

Specifically, pass the priority through to `publish_another()`. Done by
adding a `priority` attribute to the burner class.
  • Loading branch information...
1 parent 2682853 commit 9da2ddee62aaf5445b61991aa3af467e7c6d9ad0 @theory theory committed Jul 29, 2010
Showing with 21 additions and 10 deletions.
  1. +2 −1 lib/Bric/Changes.pod
  2. +19 −9 lib/Bric/Util/Burner.pm
View
3 lib/Bric/Changes.pod
@@ -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
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
-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 *
View
28 lib/Bric/Util/Burner.pm
@@ -276,6 +276,7 @@ BEGIN {
base_uri => Bric::FIELD_READ,
burn_again => Bric::FIELD_RDWR,
resources => Bric::FIELD_READ,
+ priority => Bric::FIELD_READ,
# Private Fields
_page_extensions => Bric::FIELD_NONE,
@@ -372,6 +373,7 @@ sub new {
$init->{_page_extensions} ||= [''];
$init->{_notes} = {};
$init->{resources} = [];
+ $init->{priority} ||= 3;
$init->{_output_preview_msgs} = 1
unless defined $init->{_output_preview_msgs};
@@ -496,14 +498,14 @@ sub flush_another_queue {
my $class = shift;
return $class unless @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;
Bric::Util::Job::Pub->new({
sched_time => $pub_time,
user_id => get_user_id(),
name => 'Publish "' . $doc->get_name . '"',
"$key\_instance_id" => $doc->get_version_id,
- priority => $doc->get_priority,
+ priority => $priority,
notes => $notes,
})->save;
}
@@ -1260,11 +1262,14 @@ sub publish {
my $repub = $ba->get_publish_status;
# 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_status(1) unless $repub;
$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.
my $exp_date = $ba->get_expire_date(ISO_8601_FORMAT);
@@ -1326,7 +1331,7 @@ sub publish {
name => $name,
server_types => $bat,
"$key\_instance_id" => $ba->get_version_id,
- priority => $priority || $ba->get_priority,
+ priority => $self->get_priority,
});
# Burn, baby, burn!
@@ -1421,7 +1426,7 @@ sub publish {
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;
}
@@ -1496,7 +1501,7 @@ sub publish_another {
throw_burn_error(
error => qq{Cannot publish $key "$uri" because it is checked out. }
. '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,
);
}
@@ -1526,7 +1531,12 @@ sub publish_another {
} else {
# Add it to the publish_another queue.
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;
}
@@ -2264,7 +2274,7 @@ sub _expire {
name => $expname,
resources => $res,
type => 1,
- priority => $ba->get_priority,
+ priority => $self->get_priority,
$ba->key_name . '_instance_id' => $ba->get_version_id,
});
$exp_job->save;

0 comments on commit 9da2dde

Please sign in to comment.
Something went wrong with that request. Please try again.