[Rt-commit] rt branch, 4.0/lock-fulltext-indexer, created. rt-4.0.20rc1-1-gffc51a3
? sunnavy
sunnavy at bestpractical.com
Thu May 8 12:08:05 EDT 2014
The branch, 4.0/lock-fulltext-indexer has been created
at ffc51a3253f1fffe1a5ff09fac01d4548c303979 (commit)
- Log -----------------------------------------------------------------
commit ffc51a3253f1fffe1a5ff09fac01d4548c303979
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu May 8 23:49:55 2014 +0800
lock rt-fulltext-indexer so only one instance can be run at the same time
multiple instances eat more cpu and may also break stuff.
see also #17423
diff --git a/sbin/rt-fulltext-indexer.in b/sbin/rt-fulltext-indexer.in
index b84ca94..4280296 100644
--- a/sbin/rt-fulltext-indexer.in
+++ b/sbin/rt-fulltext-indexer.in
@@ -122,6 +122,12 @@ if ( $OPT{'help'} ) {
);
}
+use Fcntl ':flock';
+if ( !flock main::DATA, LOCK_EX | LOCK_NB ) {
+ print STDERR "$0 is already running\n";
+ exit 1;
+}
+
my $fts_config = RT->Config->Get('FullTextSearch') || {};
unless ( $fts_config->{'Enable'} ) {
print STDERR <<EOT;
@@ -463,3 +469,4 @@ Alex Vandiver E<lt>alexmv at bestpractical.comE<gt>
=cut
+__DATA__
-----------------------------------------------------------------------
More information about the rt-commit
mailing list