Commit 6a83a1dd authored by Gervase Markham's avatar Gervase Markham Committed by Gervase Markham

Bug 706412 - make JobQueue.pm support insertion of Job objects, and also enable…

Bug 706412 - make JobQueue.pm support insertion of Job objects, and also enable prioritization. r,a=LpSolit.
parent b4fee2c3
...@@ -53,6 +53,7 @@ sub new { ...@@ -53,6 +53,7 @@ sub new {
prefix => 'ts_', prefix => 'ts_',
}], }],
driver_cache_expiration => DRIVER_CACHE_TIME, driver_cache_expiration => DRIVER_CACHE_TIME,
prioritize => 1,
); );
return $self; return $self;
...@@ -70,12 +71,19 @@ sub insert { ...@@ -70,12 +71,19 @@ sub insert {
my $self = shift; my $self = shift;
my $job = shift; my $job = shift;
if (!ref($job)) {
my $mapped_job = Bugzilla::JobQueue->job_map()->{$job}; my $mapped_job = Bugzilla::JobQueue->job_map()->{$job};
ThrowCodeError('jobqueue_no_job_mapping', { job => $job }) ThrowCodeError('jobqueue_no_job_mapping', { job => $job })
if !$mapped_job; if !$mapped_job;
unshift(@_, $mapped_job);
my $retval = $self->SUPER::insert(@_); $job = new TheSchwartz::Job(
funcname => $mapped_job,
arg => $_[0],
priority => $_[1] || 5
);
}
my $retval = $self->SUPER::insert($job);
# XXX Need to get an error message here if insert fails, but # XXX Need to get an error message here if insert fails, but
# I don't see any way to do that in TheSchwartz. # I don't see any way to do that in TheSchwartz.
ThrowCodeError('jobqueue_insert_failed', { job => $job, errmsg => $@ }) ThrowCodeError('jobqueue_insert_failed', { job => $job, errmsg => $@ })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment