IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18557


Ignore:
Timestamp:
Jul 15, 2008, 10:27:31 AM (18 years ago)
Author:
bills
Message:

If an attempt to redirect_output fails wait 5 seconds and try again.
Try 10 times before giving up. (It's always succeeded on the second or
third try). This is a workaround to the alleged 'nfs glitch'

File:
1 edited

Legend:

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

    r18086 r18557  
    11# Copyright (c) 2006  Paul Price, Joshua Hoblitt
    22#
    3 # $Id: Config.pm,v 1.90 2008-06-12 01:35:08 eugene Exp $
     3# $Id: Config.pm,v 1.91 2008-07-15 20:27:31 bills Exp $
    44
    55package PS::IPP::Config;
     
    583583    die "cannot resolve $name" unless $filename;
    584584
    585     open STDOUT, ">>$filename" or die "failed to redirect stdout to $filename";
     585    if (! open(STDOUT, ">>$filename") ) {
     586        # try to work around the 'nfs glitch' by waiting and retrying the open a couple of times
     587        print STDERR "failed to redirect stdout to $filename re-trying\n";
     588        my $max_tries = 10;
     589        my $try = 2;
     590        while (! open STDOUT, ">>$filename" ) {
     591            if ($try == $max_tries) {
     592                die "failed to redirect stdout to $filename after trying $max_tries times";
     593            }
     594            sleep 5;
     595            $try++;
     596        }
     597        print STDERR "   redirect stdout to $filename succeded on try $try\n";
     598    }
    586599    open STDERR, ">>$filename" or die "failed to redirect stderr to $filename";
    587600}
Note: See TracChangeset for help on using the changeset viewer.