forked from lix-project/hydra
Fix hydra-update-gc-roots
This commit is contained in:
parent
fb5f01097b
commit
365de86ead
|
@ -130,7 +130,10 @@ foreach my $link (@roots) {
|
||||||
# Don't delete roots that are less than a day old, to prevent
|
# Don't delete roots that are less than a day old, to prevent
|
||||||
# a race where hydra-eval-jobs has added a root but
|
# a race where hydra-eval-jobs has added a root but
|
||||||
# hydra-evaluator hasn't added them to the database yet.
|
# hydra-evaluator hasn't added them to the database yet.
|
||||||
if (lstat($path)->ctime < $now - 24 * 60 * 60) {
|
my $st = lstat("$gcRootsDir/$link");
|
||||||
|
if (!defined $st) {
|
||||||
|
print STDERR "skipping link $link: $!\n";
|
||||||
|
} elsif ($st->ctime < $now - 24 * 60 * 60) {
|
||||||
print STDERR "removing root $path\n";
|
print STDERR "removing root $path\n";
|
||||||
$rootsDeleted++;
|
$rootsDeleted++;
|
||||||
unlink "$gcRootsDir/$link" or warn "cannot remove $gcRootsDir/$link";
|
unlink "$gcRootsDir/$link" or warn "cannot remove $gcRootsDir/$link";
|
||||||
|
|
Loading…
Reference in a new issue