aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/sqlite.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-17 09:27:17 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-04-17 09:27:17 -0400
commitb1343e8ad1cd158228e9fd97c493aa888700419c (patch)
treeea1ba65f8767dbb1307cfebf39ed44746df8a7bf /src/libstore/sqlite.hh
parent615c25b0dd185fe15d6be5fe7266d0f4e0a4d807 (diff)
parent72ffa7fedb34585948f8c9a47bfaebeb6cc5d537 (diff)
Merge remote-tracking branch 'upstream/master' into trustless-remote-builder-simple
Diffstat (limited to 'src/libstore/sqlite.hh')
-rw-r--r--src/libstore/sqlite.hh6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstore/sqlite.hh b/src/libstore/sqlite.hh
index b735838ec..6e14852cb 100644
--- a/src/libstore/sqlite.hh
+++ b/src/libstore/sqlite.hh
@@ -139,7 +139,7 @@ protected:
MakeError(SQLiteBusy, SQLiteError);
-void handleSQLiteBusy(const SQLiteBusy & e);
+void handleSQLiteBusy(const SQLiteBusy & e, time_t & nextWarning);
/**
* Convenience function for retrying a SQLite transaction when the
@@ -148,11 +148,13 @@ void handleSQLiteBusy(const SQLiteBusy & e);
template<typename T, typename F>
T retrySQLite(F && fun)
{
+ time_t nextWarning = time(0) + 1;
+
while (true) {
try {
return fun();
} catch (SQLiteBusy & e) {
- handleSQLiteBusy(e);
+ handleSQLiteBusy(e, nextWarning);
}
}
}