diff options
author | Gervase Markham <gerv@gerv.net> | 2011-01-27 13:42:01 +0100 |
---|---|---|
committer | Gervase Markham <gerv@mozilla.org> | 2011-01-27 13:42:01 +0100 |
commit | 2a5c9e0c4541e0c995f5b53a26e0a9ae9195c031 (patch) | |
tree | 6d770d8bec52c90b694be19f050b732d1432afe6 /Bugzilla/JobQueue | |
parent | 73cdd3ef930602a70666d83d94bc53cc571a2a35 (diff) | |
download | bugzilla-2a5c9e0c4541e0c995f5b53a26e0a9ae9195c031.tar.gz bugzilla-2a5c9e0c4541e0c995f5b53a26e0a9ae9195c031.tar.xz |
Allow jobqueue.pl to run once and then exit. r=mkanat.
https://bugzilla.mozilla.org/show_bug.cgi?id=621256
Diffstat (limited to 'Bugzilla/JobQueue')
-rw-r--r-- | Bugzilla/JobQueue/Runner.pm | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Bugzilla/JobQueue/Runner.pm b/Bugzilla/JobQueue/Runner.pm index 20cf6439f..26755e78f 100644 --- a/Bugzilla/JobQueue/Runner.pm +++ b/Bugzilla/JobQueue/Runner.pm @@ -196,16 +196,34 @@ sub gd_setup_signals { $SIG{TERM} = sub { $self->gd_quit_event(); } } +sub gd_other_cmd { + my ($self) = shift; + if ($ARGV[0] eq "once") { + $self->_do_work("work_once"); + + exit(0); + } + + $self->SUPER::gd_other_cmd(); +} + sub gd_run { my $self = shift; + $self->_do_work("work"); +} + +sub _do_work { + my ($self, $fn) = @_; + my $jq = Bugzilla->job_queue(); $jq->set_verbose($self->{debug}); foreach my $module (values %{ Bugzilla::JobQueue->job_map() }) { eval "use $module"; $jq->can_do($module); } - $jq->work; + + $jq->$fn; } 1; |