* Hack around those SQLite timeouts: just retry the transaction.
This commit is contained in:
@ -8,7 +8,7 @@ use File::Basename;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(
|
||||
isValidPath queryPathInfo
|
||||
getHydraPath getHydraDBPath openHydraDB
|
||||
getHydraPath getHydraDBPath openHydraDB txn_do
|
||||
registerRoot getGCRootsDir gcRootFor
|
||||
getPrimaryBuildsForReleaseSet getRelease getLatestSuccessfulRelease );
|
||||
|
||||
@ -78,6 +78,21 @@ sub openHydraDB {
|
||||
}
|
||||
|
||||
|
||||
# Awful hack to handle timeouts in SQLite: just retry the transaction.
|
||||
# DBD::SQLite *has* a 30 second retry window, but apparently it
|
||||
# doesn't work.
|
||||
sub txn_do {
|
||||
my ($db, $coderef) = @_;
|
||||
while (1) {
|
||||
eval {
|
||||
$db->txn_do($coderef);
|
||||
};
|
||||
last if !$@;
|
||||
die $@ unless $@ =~ "database is locked";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub getGCRootsDir {
|
||||
die unless defined $ENV{LOGNAME};
|
||||
my $dir = "/nix/var/nix/gcroots/per-user/$ENV{LOGNAME}/hydra-roots";
|
||||
|
Reference in New Issue
Block a user