[Jifty-commit] r4871 - in jifty/trunk: lib/Jifty/Plugin

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jan 17 15:13:10 EST 2008


Author: alexmv
Date: Thu Jan 17 15:13:03 2008
New Revision: 4871

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/Monitoring.pm

Log:
 r26865 at zoq-fot-pik:  chmrr | 2008-01-17 15:09:30 -0500
  * lockfile error-proofing


Modified: jifty/trunk/lib/Jifty/Plugin/Monitoring.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Monitoring.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Monitoring.pm	Thu Jan 17 15:13:03 2008
@@ -194,7 +194,7 @@
     my @path = $args{path} ? @{$args{path}} : (Jifty->app_class("Monitor"));
     $self->base_classes(\@path);
     $self->monitors({});
-    $self->lockfile($args{lockfile} || "var/monitoring.pid");
+    $self->lockfile($args{lockfile} || Jifty::Util->absolute_path("var/monitoring.pid"));
     local $Jifty::Plugin::Monitoring::self = $self;
     Jifty::Module::Pluggable->import(
         require => 1,
@@ -303,7 +303,10 @@
 sub lock {
     my $self = shift;
     return if -e $self->lockfile;
-    open PID, ">", $self->lockfile;
+    unless (open PID, ">", $self->lockfile) {
+        warn "Can't open lockfile @{[$self->lockfile]}: $!";
+        return 0;
+    }
     print PID $$;
     close PID;
     $self->has_lock(1);


More information about the Jifty-commit mailing list