source: trunk/LATMOS-Accounts/patchset/no_useless_load.patch @ 2411

Last change on this file since 2411 was 792, checked in by nanardon, 14 years ago
  • avoid base reloading by using cache
  • add possible patch to avoid several base load (needing lot of tests)
File size: 1.9 KB
  • lib/LATMOS/Accounts/Synchro.pm

    This patch avoid load() on base to be call several time. Bases are supposed to
    be load by end point script and not lazilly to check access is OK.
    The problem with this patch is we need to check all tools to verify load() is
    really called :\ Dangerous at time.
     
    7575    foreach (ref($to) eq 'ARRAY' ? @{ $to || []} : ($to)) { 
    7676        push(@{$self->{to}}, $_); 
    7777    } 
    78     bless($self, $class) 
     78    bless($self, $class); 
     79    $self->from->load or return; 
     80    return $self; 
    7981} 
    8082 
    8183sub name { 
     
    103105    my ($self) = @_; 
    104106    my @loaded; 
    105107    my $unloaded = 0; 
     108 
    106109    foreach ($self->to) { 
    107110        if($_->load) { 
    108111            push(@loaded, $_); 
     
    117120 
    118121sub enter_synch_mode { 
    119122    my ($self) = @_; 
    120     $self->from->load or return; 
     123    # $self->from->load or return; 
    121124    # if any cannot be loaded, return, 
    122125    # TODO we need a way to force if some still can be sync 
    123     $self->load_dest and return; 
     126 
    124127    my %state = (); 
    125128    $state{$self->from->label} = $self->from->wexported(0); 
    126129    foreach ($self->to) { 
  • lib/LATMOS/Accounts.pm

     
    156156        la_log(LA_WARN, "Cannot instanciate base $section ($type)"); 
    157157        return; 
    158158    }; 
    159     $base->load or return; 
    160159    $base; 
    161160} 
    162161 
     
    234233        ); 
    235234    } 
    236235 
     236    my @unload = grep { ! $_->load } @obases; 
     237    if (@unload) { 
     238        la_log(LA_ERR, "Cannot load base part of syncaccess %s", join(', ', map 
     239                { $_->label } @unload)); 
     240        return; 
     241    } 
    237242    LATMOS::Accounts::SynchAccess->new([ @obases ]); 
    238243} 
    239244 
Note: See TracBrowser for help on using the repository browser.