diff options
author | Ben Radford <benradf@users.noreply.github.com> | 2023-04-11 16:03:37 +0100 |
---|---|---|
committer | Ben Radford <benradf@users.noreply.github.com> | 2023-04-11 16:14:16 +0100 |
commit | de3df3009bf003f327d35e246d5904d93273e2e9 (patch) | |
tree | 75e7f17f5dda6717470d845ee750c680c23c4519 /src/libstore/sqlite.hh | |
parent | da322ebda62470acbf5373374c4cee8236705c2f (diff) |
Move warning timing logic into handleSQLiteBusy.
Diffstat (limited to 'src/libstore/sqlite.hh')
-rw-r--r-- | src/libstore/sqlite.hh | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/libstore/sqlite.hh b/src/libstore/sqlite.hh index e2c9e28f8..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, bool shouldWarn); +void handleSQLiteBusy(const SQLiteBusy & e, time_t & nextWarning); /** * Convenience function for retrying a SQLite transaction when the @@ -153,17 +153,8 @@ T retrySQLite(F && fun) while (true) { try { return fun(); - } catch (SQLiteBusy & e) { - time_t now = time(0); - bool shouldWarn = false; - - if (now > nextWarning) { - nextWarning = now + 10; - shouldWarn = true; - } - - handleSQLiteBusy(e, shouldWarn); + handleSQLiteBusy(e, nextWarning); } } } |