From: Lebbeous Fogle-Weekley Date: Tue, 29 Jan 2013 17:33:21 +0000 (-0500) Subject: Acq: Prevent problem in preventing EDI re-retrieves X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=20e73d87bbffa76c1de510fe6a3b18990596cd5e;p=working%2FEvergreen.git Acq: Prevent problem in preventing EDI re-retrieves The query we were using before would needlessly transfer large objects, potentially hitting Jabber message size limits. We're just testing for the existence of such objects, so we need no more than a single ID in the result. Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm index 962ad416a1..a6b65a856c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm @@ -117,19 +117,29 @@ sub retrieve_core { # same FTP site and credentials. If we only checked based on # acq.edi_account.id, we'd not find out in those cases that we've # already processed the same file before. - my $hits = $e->search_acq_edi_message([ - { - "+acqedi" => { - host => $account->host, - username => $account->username, - password => $account->password, - in_dir => $account->in_dir + my $hits = $e->search_acq_edi_message( + [ + { + "+acqedi" => { + host => $account->host, + username => $account->username, + password => $account->password, + in_dir => $account->in_dir + }, + remote_file => $remote_file, + status => {'in' => [qw/ processed /]}, }, - remote_file => $remote_file, - status => {'in' => [qw/ processed /]}, - }, - { join => {"acqedi" => {}} } - ]); + { join => {"acqedi" => {}}, limit => 1 } + ], { idlist => 1 } + ); + + if (!$hits) { + my $msg = "EDI: test for already-retrieved files yielded " . + "event " . $e->event->{textcode}; + $logger->warn($msg); + warn $msg; + return $e->die_event; + } if (@$hits) { $logger->debug("EDI: $remote_file already retrieved. Skipping");