# git-cache-proxy
# Copyright 2010 Tony Finch
-# Copyright 2013 Ian Jackson
+# Copyright 2013,2014 Ian Jackson
+# Copyright 2017 Citrix
#
# git-cache-proxy is free software; you can redistribute it and/or
# modify them under the terms of the GNU General Public License as
our $debug = 0;
our $housekeepingeverydays = 1;
our $treeexpiredays = 21;
-our $fetchtimeout = 1800;
-our $maxfetchtimeout = 3600;
+our $fetchtimeout = 3600;
+our $maxfetchtimeout = 7200;
+our $servetimeout = 3600;
our $cachedir = '/var/cache/git-cache-proxy';
our $housekeepingonly = 0;
$cachedir = $1;
} elsif (s/^--( max-fetch-timeout
| fetch-timeout
+ | serve-timeout
| tree-expire-days
| housekeeping-interval-days
)=(\d+)$//x) {
servinfo "fetch/clone failed: $fetchfail";
}
}
+ alarm 0;
if (!$exists) {
rename $tmpd, $gitd or fail "rename fresh $tmpd to $gitd: $!";
die "$dir: cannot rename to $tdir: $!\n";
}
}
- my $errs;
- remove_tree($tdir, { safe=>1, error=>\$errs });
- if (!stat $tdir) {
- foreach my $err (@$errs) {
- my ($file, $message) = %$err;
- logm 'info', "problem deleting: $file: $message";
- }
- die "$dir: problem deleting file(s)\n";
+ system qw(rm -rf --), $tdir;
+ if (stat $tdir) {
+ die "$dir: problem deleting file(s), rm exited $?\n";
} elsif ($! != ENOENT) {
die "$tdir: cannot stat after deletion: $!\n";
}
}
if ($dofork) {
my $child = fork;
- defined $child or hkfail "fork: $!";
+ defined $child or fail "fork: $!";
if (!$child) {
+ open STDERR, "|logger -p daemon.warning -t '$us(housekeeping)'"
+ or die "fork: logger $!";
housekeeping();
exit 0;
}
chdir $gitd or fail "chdir $gitd: $!";
- exec qw(git-upload-pack --strict --timeout=1000 .)
+ exec qw(git-upload-pack --strict), "--timeout=$servetimeout", qw(.)
or fail "exec git-upload-pack: $!";
}