From: Dylan William Hardison Date: Tue, 8 Jan 2019 03:30:36 +0000 (-0500) Subject: Bug 1517606 - Prevent infinite loops by making workers die after 5 minutes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cecff194ceb510020cebd812c5a55be170b0e07;p=thirdparty%2Fbugzilla.git Bug 1517606 - Prevent infinite loops by making workers die after 5 minutes --- diff --git a/Bugzilla/JobQueue.pm b/Bugzilla/JobQueue.pm index c2c5827a3..792883de3 100644 --- a/Bugzilla/JobQueue.pm +++ b/Bugzilla/JobQueue.pm @@ -130,7 +130,11 @@ sub work { first_interval => 0, interval => $delay, reschedule => 'drift', - on_tick => sub { $self->work_once } + on_tick => sub { + alarm(60 * 5); + $self->work_once; + alarm(0); + } ); DEBUG("working every $delay seconds"); $loop->add($timer); diff --git a/jobqueue-worker.pl b/jobqueue-worker.pl index 298185d40..42e8f3424 100755 --- a/jobqueue-worker.pl +++ b/jobqueue-worker.pl @@ -18,7 +18,6 @@ BEGIN { my $dir = rel2abs(dirname(__FILE__)); lib->import($dir, catdir($dir, 'lib'), catdir($dir, qw(local lib perl5))); chdir $dir or die "chdir $dir failed: $!"; - } use Bugzilla::JobQueue::Worker;