$class =~ s/^Fieldmapper:://o;
$class =~ s/::/_/go;
-
my $method = 'search_'. $class;
- my $object_ids = $editor->$method( $filter, {idlist => 1, timeout => 7200} );
+
+ # for cleaner logging
+ my $def_id = $def->id;
+ my $hook = $def->hook;
+
+ $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} );
+
+ if($object_ids) {
+ $logger->info("trigger: create_batch_events() fetched ".scalar(@$object_ids)." object IDs for def=$def_id / hook=$hook");
+ } else {
+ $logger->warn("trigger: create_batch_events() timeout occurred collecting object IDs for def=$def_id / hook=$hook");
+ }
for my $o_id (@$object_ids) {
$client->respond( $event->id );
}
+
+ $logger->info("trigger: create_batch_events() successfully created events for def=$def_id / hook=$hook");
}
+ $logger->info("trigger: create_batch_events() done creating events");
+
$editor->commit;
return undef;
my $e = OpenILS::Application::Trigger::Event->new($event_id);
if ($e->validate->valid) {
- $logger->info("Event is valid, reacting...");
+ $logger->info("trigger: Event is valid, reacting...");
$e->react->cleanup;
}
my $e = OpenILS::Application::Trigger::EventGroup->new(@$events);
if ($e->validate->valid) {
- $logger->info("Event group is valid, reacting...");
+ $logger->info("trigger: Event group is valid, reacting...");
$e->react->cleanup;
}
}
return $editor->search_action_trigger_event(
- $query, { idlist=> 1, timeout => 7200 }
+ $query, { idlist=> 1, timeout => 7200, substream => 1 }
);
}
__PACKAGE__->register_method(
my %groups = ( '*' => [] );
+ if($events) {
+ $logger->info("trigger: grouped_events found ".scalar(@$events)." pending events to process");
+ } else {
+ $logger->warn("trigger: grouped_events timed out loading pending events");
+ return \%groups;
+ }
+
for my $e_id ( @$events ) {
$logger->info("trigger: processing event $e_id");
try {
$e = OpenILS::Application::Trigger::Event->new($e_id);
} catch Error with {
- $logger->error("Event creation failed with ".shift());
+ $logger->error("trigger: Event creation failed with ".shift());
};
next unless $e;
try {
$e->build_environment;
} catch Error with {
- $logger->error("Event environment building failed with ".shift());
+ $logger->error("trigger: Event environment building failed with ".shift());
};
if (my $group = $e->event->event_def->group_field) {
for my $def ( keys %$groups ) {
if ($def eq '*') {
+ $logger->info("trigger: run_all_events firing un-grouped events");
for my $event ( @{ $$groups{'*'} } ) {
try {
$client->respond(
->run($event)
);
} catch Error with {
- $logger->error("event firing failed with ".shift());
+ $logger->error("trigger: event firing failed with ".shift());
};
}
+ $logger->info("trigger: run_all_events completed firing un-grouped events");
+
} else {
my $defgroup = $$groups{$def};
+ $logger->info("trigger: run_all_events firing events for grouped event def=$def");
for my $ident ( keys %$defgroup ) {
try {
$client->respond(
->run($$defgroup{$ident})
);
} catch Error with {
- $logger->error("event firing failed with ".shift());
+ $logger->error("trigger: event firing failed with ".shift());
};
}
+ $logger->info("trigger: run_all_events completed firing events for grouped event def=$def");
}
}
use OpenSRF::System;
use OpenSRF::AppSession;
use OpenSRF::Utils::JSON;
+use OpenSRF::Utils::Logger qw/$logger/;
use OpenSRF::EX qw(:try);
use OpenILS::Utils::Fieldmapper;
+my $req_timeout = 10800;
# DEFAULT values
$method =~ s/passive/active/ if $config->{active};
my $req = $ses->request($method, $hook, $config->{context_org}, $config->{filter}, $opt_granularity);
- while (my $resp = $req->recv(timeout => 1800)) {
- $opt_debug_stdout and print OpenSRF::Utils::JSON->perl2JSON($resp->content) . "\n";
+
+ my $debug_hook = "'$hook' and filter ".OpenSRF::Utils::JSON->perl2JSON($config->{filter});
+ $logger->info("at_runner: creating events for $debug_hook");
+
+ my @event_ids;
+ while (my $resp = $req->recv(timeout => $req_timeout)) {
+ push(@event_ids, $resp->content);
+ }
+
+ if(@event_ids) {
+ $logger->info("at_runner: created ".scalar(@event_ids)." events for $debug_hook");
+ } elsif($req->complete) {
+ $logger->info("at_runner: no events to create for $debug_hook");
+ } else {
+ $logger->warn("at_runner: timeout occurred during event creation for $debug_hook");
}
}
}
my $req = $ses->request('open-ils.trigger.event.run_all_pending' => $opt_granularity);
my $check_lockfile = 1;
- while (my $resp = $req->recv(timeout => 7200)) {
+ while (my $resp = $req->recv(timeout => $req_timeout)) {
if ($check_lockfile && -e $opt_lockfile) {
open LF, $opt_lockfile;
my $contents = <LF>;