From: erickson Date: Fri, 16 Jul 2010 14:12:44 +0000 (+0000) Subject: back-porting action trigger fixes 16956 and 16953 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8bf8a31e27cf2bd89d2aa2343a07543a65ce6b9e;p=working%2FEvergreen.git back-porting action trigger fixes 16956 and 16953 git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6_1@16958 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm b/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm index c5d38bd351..f4c64d97f5 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm @@ -409,16 +409,14 @@ sub create_batch_events { 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 @@ sub create_batch_events { $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"); diff --git a/Open-ILS/src/support-scripts/action_trigger_runner.pl b/Open-ILS/src/support-scripts/action_trigger_runner.pl index 40eae8f04e..2fb5518f2c 100755 --- a/Open-ILS/src/support-scripts/action_trigger_runner.pl +++ b/Open-ILS/src/support-scripts/action_trigger_runner.pl @@ -174,7 +174,10 @@ help() and exit unless ($opt_run_pending or $opt_process_hooks); 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