--- loncom/lonnet/perl/lonnet.pm 2015/05/21 23:40:25 1.1287 +++ loncom/lonnet/perl/lonnet.pm 2015/06/12 21:11:20 1.1288 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1287 2015/05/21 23:40:25 raeburn Exp $ +# $Id: lonnet.pm,v 1.1288 2015/06/12 21:11:20 damieng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -101,11 +101,12 @@ use LONCAPA qw(:DEFAULT :match); use LONCAPA::Configuration; use LONCAPA::lonmetadata; use LONCAPA::Lond; +use Time::HiRes qw(sleep); use File::Copy; my $readit; -my $max_connection_retries = 10; # Or some such value. +my $max_connection_retries = 20; # Or some such value. require Exporter; @@ -375,7 +376,7 @@ sub subreply { my $lockfile=$peerfile.".lock"; while (-e $lockfile) { # Need to wait for the lockfile to disappear. - sleep(1); + Time::HiRes::sleep(0.1); } # At this point, either a loncnew parent is listening or an old lonc # or loncnew child is listening so we can connect or everything's dead. @@ -393,7 +394,7 @@ sub subreply { } else { &create_connection(&hostname($server),$server); } - sleep(1); # Try again later if failed connection. + Time::HiRes::sleep(0.1); # Try again later if failed connection. } my $answer; if ($client) { @@ -486,7 +487,7 @@ sub critical { close($dfh); } } - sleep 2; + sleep 1; my $wcmd=''; { my $dfh; @@ -7678,7 +7679,7 @@ sub get_query_reply { my $replyfile=LONCAPA::tempdir().$queryid; my $reply=''; for (1..100) { - sleep 2; + Time::HiRes::sleep(0.2); if (-e $replyfile.'.end') { if (open(my $fh,$replyfile)) { $reply = join('',<$fh>); @@ -9521,9 +9522,9 @@ sub modify_access_controls { my $tries = 0; my $gotlock = &newput('file_permissions',$lockhash,$domain,$user); - while (($gotlock ne 'ok') && $tries <3) { + while (($gotlock ne 'ok') && $tries < 10) { $tries ++; - sleep 1; + Time::HiRes::sleep(0.1); $gotlock = &newput('file_permissions',$lockhash,$domain,$user); } if ($gotlock eq 'ok') {