[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonrep.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 26 Apr 2007 01:18:47 -0000
albertel Wed Apr 25 21:18:47 2007 EDT
Modified files:
/loncom/lonnet/perl lonrep.pm
Log:
- attempt to work around an error that was seen
Index: loncom/lonnet/perl/lonrep.pm
diff -u loncom/lonnet/perl/lonrep.pm:1.12 loncom/lonnet/perl/lonrep.pm:1.13
--- loncom/lonnet/perl/lonrep.pm:1.12 Mon Jan 29 17:07:12 2007
+++ loncom/lonnet/perl/lonrep.pm Wed Apr 25 21:18:47 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Replication Manager
#
-# $Id: lonrep.pm,v 1.12 2007/01/29 22:07:12 albertel Exp $
+# $Id: lonrep.pm,v 1.13 2007/04/26 01:18:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,13 +39,18 @@
my $oldfile = $r->filename($filename);
if ($ENV{'MOD_PERL_API_VERSION'} == 2
&& -e $filename) {
- require APR::Finfo;
- require APR::Const;
- $r->finfo(APR::Finfo::stat($filename,
- &APR::Const::FINFO_NORM(),
- $r->pool));
+ eval {
+ require APR::Finfo;
+ require APR::Const;
+ $r->finfo(APR::Finfo::stat($filename,
+ &APR::Const::FINFO_NORM(),
+ $r->pool));
+ };
+ if ($@) {
+ return $@;
+ }
}
- return $oldfile;
+ return;
}
sub handler {
@@ -58,17 +63,25 @@
if (-e "$filename.in.transfer") {
sleep 10;
if (-e $filename) {
- &update_filename($r,$filename);
+ my $error = &update_filename($r,$filename);
+ if ($error) {
+ $r->log_reason('Update filename failed '.$error);
+ return HTTP_SERVICE_UNAVAILABLE;
+ }
return OK;
} else {
$r->log_reason("Waiting for file transfer timed out",$filename);
return HTTP_SERVICE_UNAVAILABLE;
}
} else {
- my $response=Apache::lonnet::repcopy($filename);
+ my $response=&Apache::lonnet::repcopy($filename);
if ($response eq 'ok' && -e $filename) {
$r->path_info('');
- &update_filename($r,$filename);
+ my $error = &update_filename($r,$filename);
+ if ($error) {
+ $r->log_reason('Update filename failed after replication '.$error);
+ return HTTP_SERVICE_UNAVAILABLE;
+ }
return OK;
}
my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));