[open-ils-commits] r14863 - trunk/Open-ILS/src/support-scripts (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 10 21:04:47 EST 2009


Author: miker
Date: 2009-11-10 21:04:45 -0500 (Tue, 10 Nov 2009)
New Revision: 14863

Modified:
   trunk/Open-ILS/src/support-scripts/action_trigger_runner.pl
Log:
Unlink the lock file as soon as possible if 1) we have not already looked at it and 2) it contains our pid.  This is to allow multiple, concurrent runners where possible, after the find-events phase

Modified: trunk/Open-ILS/src/support-scripts/action_trigger_runner.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/action_trigger_runner.pl	2009-11-11 00:05:35 UTC (rev 14862)
+++ trunk/Open-ILS/src/support-scripts/action_trigger_runner.pl	2009-11-11 02:04:45 UTC (rev 14863)
@@ -141,7 +141,16 @@
     return unless $opt_run_pending;
     my $ses = OpenSRF::AppSession->create('open-ils.trigger');
     my $req = $ses->request('open-ils.trigger.event.run_all_pending' => $opt_granularity);
+
+    my $check_lockfile = 1;
     while(my $resp = $req->recv(timeout => 7200)) {
+        if ($check_lockfile && -e $opt_lockfile) {
+            open LF, $opt_lockfile;
+            my $contents = <LF>;
+            close LF;
+            unlink $opt_lockfile if ($contents == $$);
+            $check_lockfile = 0;
+        }
         if($opt_debug_stdout) {
             print OpenSRF::Utils::JSON->perl2JSON($resp->content) . "\n";
         }
@@ -166,7 +175,10 @@
     warn "$e\n";
 };
 
-unlink $opt_lockfile;
+if (-e $opt_lockfile) {
+    open LF, $opt_lockfile;
+    my $contents = <LF>;
+    close LF;
+    unlink $opt_lockfile if ($contents == $$);
+}
 
-
-



More information about the open-ils-commits mailing list