Changeset 2617


Ignore:
Timestamp:
05/14/24 17:23:06 (2 weeks ago)
Author:
nanardon
Message:

Optimize filter search when synchronize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm

    r2616 r2617  
    298298            if (my $filter = $self->{options}->{$filtername}) { 
    299299                la_log(LA_DEBUG, "Found %s param, using it: %s", $filtername, $filter); 
    300                     foreach my $id ( $self->from->search_objects($otype, $filter, 'oalias=NULL') ) { 
    301                         my $obj = $self->from->get_object( $otype, $id ); 
    302                         my $id = $obj->get_attributes( $SyncKeyAttribute ); 
    303                         $filtering{$otype}{ $id } = 1; 
     300                my @ids = $self->from->search_objects($otype, $filter, 'oalias=NULL'); 
     301                if ( $SyncKeyAttribute ) { 
     302                    my %attrValues = $self->from->attributes_summary_by_object($otype, $SyncKeyAttribute ); 
     303                    foreach ( @ids ) { 
     304                        $attrValues{ $_ } or next; 
     305                        $filtering{$otype}{ $attrValues{ $_ } } = 1; 
    304306                    } 
     307                } else { 
     308                    foreach ( @ids ) { 
     309                        $filtering{$otype}{ $_ } = 1; 
     310                    } 
     311                } 
    305312            } else { 
    306313                $filtering{$otype} = $existings{$otype}; 
    307314            } 
    308  
    309315 
    310316            # deleting non existing object in dest: 
Note: See TracChangeset for help on using the changeset viewer.