
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Evergreen ILS". The branch, main has been updated via f80042746abf5c3402529659d87cca225f24fd98 (commit) from 9ef0fa4e14c446896295556f095f2c026d758a9c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f80042746abf5c3402529659d87cca225f24fd98 Author: Jason Stephenson <jason@sigio.com> Date: Thu Jun 6 13:06:19 2024 -0400 LP1836908: Improve EDI file retrieval Reduce the number of connections to remote hosts by deduplicating the set of accounts based on host, username, password, and directory. Release-note: Reduce remote connections in EDI file retrieval by connecting only once per account. Signed-off-by: Jason Stephenson <jason@sigio.com> 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 28c1e8cd49..26a06a2924 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm @@ -85,14 +85,26 @@ sub retrieve_core { $e ||= new_editor(); $set ||= __PACKAGE__->retrieve_vendors($e); + # Deduplicate the set based on host, username, password, and + # in_dir to eliminate unnecessary connections to the remote host. + my @subset = (); + foreach my $i (@$set) { + unless (@subset) { + push @subset, $i; + } elsif (! grep {$_->host eq $i->host && $_->username eq $i->username + && $_->password eq $i->password && $_->in_dir eq $i->in_dir} @subset) { + push @subset, $i; + } + } + my @return = (); my $vcount = 0; - foreach my $account (@$set) { + foreach my $account (@subset) { my $count = 0; my $server; $logger->info( "EDI check for vendor " . - ++$vcount . " of " . scalar(@$set) . ": " . $account->host + ++$vcount . " of " . scalar(@subset) . ": " . $account->host ); unless ($server = __PACKAGE__->remote_account($account)) { # assignment $logger->err( @@ -119,7 +131,7 @@ sub retrieve_core { foreach my $remote_file (@ok_files) { my $description = sprintf "%s/%s", $account->host, $remote_file; - + # deduplicate vs. acct/filenames already in DB. # # The reason we match against host/username/password/in_dir ----------------------------------------------------------------------- Summary of changes: .../src/perlmods/lib/OpenILS/Application/Acq/EDI.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) hooks/post-receive -- Evergreen ILS