summaryrefslogtreecommitdiffstats
path: root/arecibo.pl
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-03-26 07:33:54 +0100
committerByron Jones <bjones@mozilla.com>2013-03-26 07:33:54 +0100
commit7f31fde3a03881e59220e824a4ea390f65608ed9 (patch)
treeb3518a487106b031f9f7fe1c4048fac40cb07fb9 /arecibo.pl
parentf78bc351db35dd8209240eb89bbf45d69e06c0ee (diff)
downloadbugzilla-7f31fde3a03881e59220e824a4ea390f65608ed9.tar.gz
bugzilla-7f31fde3a03881e59220e824a4ea390f65608ed9.tar.xz
Bug 854769: arecibo is causing high load over short durations
Diffstat (limited to 'arecibo.pl')
-rwxr-xr-xarecibo.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/arecibo.pl b/arecibo.pl
index a6199a194..93c34c999 100755
--- a/arecibo.pl
+++ b/arecibo.pl
@@ -21,10 +21,13 @@ use lib $Bin;
use lib "$Bin/lib";
use Bugzilla;
+use Bugzilla::Constants;
use File::Slurp;
use POSIX qw(setsid nice);
use Safe;
+use Fcntl qw(:flock);
+Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
nice(19);
# detach
@@ -47,9 +50,16 @@ my $cpt = new Safe;
$cpt->reval($dump) || exit(1);
my $data = ${$cpt->varglob('VAR1')};
+# ensure we send warnings one at a time per webhead
+flock(DATA, LOCK_EX);
+
# and post to arecibo
my $agent = LWP::UserAgent->new(
agent => 'bugzilla.mozilla.org',
timeout => 10, # seconds
);
$agent->post($arecibo_server, $data);
+
+__DATA__
+this exists so the flock() code works.
+do not remove this data section.