diff options
author | Gervase Markham <gerv@gerv.net> | 2012-04-11 09:37:07 +0100 |
---|---|---|
committer | Gervase Markham <gerv@mozilla.org> | 2012-04-11 09:37:07 +0100 |
commit | 6a83a1dd95d39a9a438ed105daf29c3f42218435 (patch) | |
tree | e35656df2e5465b25cb2b022fbc72e58e72a6576 | |
parent | b4fee2c33267420765ed2bf15a639a5d36d35fc5 (diff) | |
download | bugs-6a83a1dd95d39a9a438ed105daf29c3f42218435.tar bugs-6a83a1dd95d39a9a438ed105daf29c3f42218435.tar.gz bugs-6a83a1dd95d39a9a438ed105daf29c3f42218435.tar.bz2 bugs-6a83a1dd95d39a9a438ed105daf29c3f42218435.tar.xz bugs-6a83a1dd95d39a9a438ed105daf29c3f42218435.zip |
Bug 706412 - make JobQueue.pm support insertion of Job objects, and also enable prioritization. r,a=LpSolit.
-rw-r--r-- | Bugzilla/JobQueue.pm | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Bugzilla/JobQueue.pm b/Bugzilla/JobQueue.pm index ceea53809..f8bd6a615 100644 --- a/Bugzilla/JobQueue.pm +++ b/Bugzilla/JobQueue.pm @@ -53,6 +53,7 @@ sub new { prefix => 'ts_', }], driver_cache_expiration => DRIVER_CACHE_TIME, + prioritize => 1, ); return $self; @@ -70,12 +71,19 @@ sub insert { my $self = shift; my $job = shift; - my $mapped_job = Bugzilla::JobQueue->job_map()->{$job}; - ThrowCodeError('jobqueue_no_job_mapping', { job => $job }) - if !$mapped_job; - unshift(@_, $mapped_job); + if (!ref($job)) { + my $mapped_job = Bugzilla::JobQueue->job_map()->{$job}; + ThrowCodeError('jobqueue_no_job_mapping', { job => $job }) + if !$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 # I don't see any way to do that in TheSchwartz. ThrowCodeError('jobqueue_insert_failed', { job => $job, errmsg => $@ }) |