summaryrefslogtreecommitdiff
path: root/infra
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-06-23 13:26:43 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-06-23 14:14:10 +0100
commit5fa6ed1bb3458f5077a46eb0c6516c277d93318c (patch)
tree1f9b1570cb64a3155e1a9a63d6ac5d5e12c6a3a2 /infra
parent9e3287b0f9611af321b7cb1ca7b7757dbe96cfd2 (diff)
Infra: Improve db retry handling
Use theh new poldb_setup hook to (a) set up HandleError and (b) run the DGIT_RPD_TEST_DBLOOP_HOOK. This is needed because the PRAGMA in poldb_setup can cause a SQLITE_BUSY error in newer sqlite3, and we want both the HandleError setup and the hook (which sets a timeout, amongst other things) to occur before sqlite3 tries to take its lock.
Diffstat (limited to 'infra')
-rwxr-xr-xinfra/dgit-repos-policy-debian19
1 files changed, 10 insertions, 9 deletions
diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian
index 4af7551..b21f797 100755
--- a/infra/dgit-repos-policy-debian
+++ b/infra/dgit-repos-policy-debian
@@ -461,17 +461,18 @@ my @orgargv = @ARGV;
for (;;) {
@ARGV = @orgargv;
eval {
- poldb_setup(poldb_path($repos));
- $stderr = '';
+ poldb_setup(poldb_path($repos), sub {
+ $poldbh->{HandleError} = sub {
+ return 0 unless $poldbh->err == 5; # SQLITE_BUSY, not in .pm :-(
+ die bless { }, $db_busy_exception;
+ };
- eval ($ENV{'DGIT_RPD_TEST_DBLOOP_HOOK'}//'');
- die $@ if length $@;
- # used by tests/tests/debpolicy-dbretry
+ eval ($ENV{'DGIT_RPD_TEST_DBLOOP_HOOK'}//'');
+ die $@ if length $@;
+ # used by tests/tests/debpolicy-dbretry
+ });
- $poldbh->{HandleError} = sub {
- return 0 unless $poldbh->err == 5; # SQLITE_BUSY, not in .pm :-(
- die bless { }, $db_busy_exception;
- };
+ $stderr = '';
$rcode = $fn->();
die unless defined $rcode;