# 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");