IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11518


Ignore:
Timestamp:
Jan 31, 2007, 4:22:31 PM (19 years ago)
Author:
eugene
Message:

multiple tries on NFS timeouts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Config/lib/PS/IPP/Config.pm

    r11498 r11518  
    11# Copyright (c) 2006  Paul Price, Joshua Hoblitt
    22#
    3 # $Id: Config.pm,v 1.26 2007-02-01 00:52:42 eugene Exp $
     3# $Id: Config.pm,v 1.27 2007-02-01 02:22:31 eugene Exp $
    44
    55package PS::IPP::Config;
     
    102102    my $found = 0;                      # Found it?
    103103    my $realfile;
    104     foreach my $path (@path) {
    105         $realfile = File::Spec->rel2abs( $filename, $path );
    106         if (-f $realfile) {
    107             $found = 1;
    108             last;
    109         }
    110     }
    111     if (not $found) {
    112         ## try again after a moment?
    113         system ("df");
    114         select(undef, undef, undef, 0.25);
    115 
     104    my $tries = 0;
     105    while (not $found) {
    116106        ## try a second time
    117107        foreach my $path (@path) {
    118             print "trying: filename: $filename, path: $path -> ";
    119108            $realfile = File::Spec->rel2abs( $filename, $path );
    120             print "test: $realfile\n";
     109            if ($tries) {
     110                print "re-trying ($tries): filename: $filename, path: $path -> ";
     111                print "test: $realfile\n";
     112            }
    121113            if (-f $realfile) {
    122114                $found = 1;
     
    124116            }
    125117        }
    126         croak "Unable to find camera configuration file $filename\n" if not $found;
     118        if (not $found) {
     119            $tries ++;
     120            if ($tries > 4) {
     121                croak "Unable to find camera configuration file $filename\n" if not $found;
     122            }
     123            ## try again after a moment?
     124            system ("df");
     125            select(undef, undef, undef, 0.25);
     126        }
    127127    }
    128128
Note: See TracChangeset for help on using the changeset viewer.