IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17725 for trunk/Nebulous/lib


Ignore:
Timestamp:
May 16, 2008, 1:37:54 PM (18 years ago)
Author:
jhoblitt
Message:

change open_create() to attempt to open the instance file 10 times before failing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/lib/Nebulous/Client.pm

    r17693 r17725  
    11# Copyright (c) 2004-2008  Joshua Hoblitt
    22#
    3 # $Id: Client.pm,v 1.49 2008-05-15 03:26:11 jhoblitt Exp $
     3# $Id: Client.pm,v 1.50 2008-05-16 23:37:54 jhoblitt Exp $
    44
    55package Nebulous::Client;
     
    171171    $log->debug( "URI is: $uri" );
    172172
     173    # XXX this is a attempt to work around some sort of nasty NFS bug where
     174    # occasionally stat()/open() on a file on an NFS mounted filesystem will
     175    # fail EVEN THOU THE FILE ACTUALLY EXISTS.
     176    #
     177    #  The instance file attempting to be opened should always exist as it was
     178    #  created by the Nebulous server.
    173179    my $fh;
    174     eval {
    175         $fh = _open_uri( $uri, '+<' );
    176     };
     180    for (my $i = 0; $i < 10; $i++) {
     181        eval {
     182            $fh = _open_uri( $uri, '+<' );
     183        };
     184        if ($@ =~ qr/file doesn't exist/) {
     185            $log->set_err($@);
     186            sleep 1;
     187        } else {
     188            last;
     189        }
     190    }
    177191    $log->logdie( $@ ) if $@;
    178192
Note: See TracChangeset for help on using the changeset viewer.