]> git.openstreetmap.org Git - chef.git/commitdiff
Don't warn when the tile cleanup script can't get a lock
authorTom Hughes <tom@compton.nu>
Sun, 6 Oct 2013 09:18:26 +0000 (10:18 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 6 Oct 2013 09:18:26 +0000 (10:18 +0100)
cookbooks/tile/templates/default/cleanup-tiles.erb

index 9209a2644d8116663b16cbfc60b951ba52981625..0f9bff288e16f0027a01828628efe1b5d185c4ca 100644 (file)
@@ -7,11 +7,13 @@ use warnings;
 
 use File::Temp qw(tmpnam);
 use Filesys::Df;
-use LockFile::Simple qw(lock unlock);
+use LockFile::Simple;
 
 my $tiledir = shift @ARGV;
 
-lock($tiledir) || exit 0;
+my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 0, -warn => 0);
+
+$lockmgr->lock($tiledir) || exit 0;
 
 my $tempfile = tmpnam();
 
@@ -49,6 +51,6 @@ if (df($tiledir)->{per} > 90)
 
 unlink($tempfile);
 
-unlock($tiledir);
+$lockmgr->unlock($tiledir);
 
 exit 0;