[open-ils-commits] r16957 - in branches/rel_1_6/Open-ILS/src: perlmods/OpenILS/Application support-scripts (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jul 16 10:11:51 EDT 2010


Author: erickson
Date: 2010-07-16 10:11:49 -0400 (Fri, 16 Jul 2010)
New Revision: 16957

Modified:
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm
   branches/rel_1_6/Open-ILS/src/support-scripts/action_trigger_runner.pl
Log:
back-porting action trigger fixes 16956 and 16953

Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm	2010-07-16 13:57:15 UTC (rev 16956)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm	2010-07-16 14:11:49 UTC (rev 16957)
@@ -409,16 +409,14 @@
             push @{ $$filter{'-and'} }, $f;
         }
 
-        push @{ $filter->{'-and'} }, {
-            '-not-exists' => {
-                from  => 'atev',
-                where => {
-                    event_def => $def->id,
-                    target    => { '=' => { '+' . $hook_hash{$def->hook}->core_type => $class->Identity } },
-                    ($active ? (state  => 'pending') : ())
-                }
+        my $join = { 'join' => {
+            atev => {
+                field => 'target',
+                fkey => $class->Identity,
+                type => 'left',
+                filter => { event_def => $def->id }
             }
-        };
+        }};
 
         $class =~ s/^Fieldmapper:://o;
         $class =~ s/::/_/go;
@@ -430,7 +428,7 @@
 
         $logger->info("trigger: create_batch_events() collecting object IDs for def=$def_id / hook=$hook");
 
-        my $object_ids = $editor->$method( $filter, {idlist => 1, timeout => 10800} );
+        my $object_ids = $editor->$method( [$filter, $join], {idlist => 1, timeout => 10800} );
 
         if($object_ids) {
             $logger->info("trigger: create_batch_events() fetched ".scalar(@$object_ids)." object IDs for def=$def_id / hook=$hook");

Modified: branches/rel_1_6/Open-ILS/src/support-scripts/action_trigger_runner.pl
===================================================================
--- branches/rel_1_6/Open-ILS/src/support-scripts/action_trigger_runner.pl	2010-07-16 13:57:15 UTC (rev 16956)
+++ branches/rel_1_6/Open-ILS/src/support-scripts/action_trigger_runner.pl	2010-07-16 14:11:49 UTC (rev 16957)
@@ -174,7 +174,10 @@
 if (-e $opt_lockfile) {
     die "I'm already running with lockfile $opt_lockfile\n" if (!$opt_process_hooks);
     # sleeping loop if we're in --process-hooks mode
-    do { last unless ( -e $opt_lockfile ); $max_sleep--; } while ($max_sleep >= 0 && sleep(1));
+    while ($max_sleep >= 0 && sleep(1)) {
+        last unless ( -e $opt_lockfile ); 
+        $max_sleep--;
+    }
 }
 
 # there's a tiny race condition here ... oh well



More information about the open-ils-commits mailing list