--refresh: Imply setting .narinfo disk cache TTL to 0

This commit is contained in:
Eelco Dolstra 2021-01-18 14:38:31 +01:00
parent 1bbc66f865
commit ea756b3654
2 changed files with 8 additions and 3 deletions

View file

@ -109,8 +109,10 @@ public:
SQLiteStmt(state->db, SQLiteStmt(state->db,
"delete from NARs where ((present = 0 and timestamp < ?) or (present = 1 and timestamp < ?))") "delete from NARs where ((present = 0 and timestamp < ?) or (present = 1 and timestamp < ?))")
.use() .use()
(now - settings.ttlNegativeNarInfoCache) // Use a minimum TTL to prevent --refresh from
(now - settings.ttlPositiveNarInfoCache) // nuking the entire disk cache.
(now - std::max(settings.ttlNegativeNarInfoCache.get(), 3600U))
(now - std::max(settings.ttlPositiveNarInfoCache.get(), 30 * 24 * 3600U))
.exec(); .exec();
debug("deleted %d entries from the NAR info disk cache", sqlite3_changes(state->db)); debug("deleted %d entries from the NAR info disk cache", sqlite3_changes(state->db));

View file

@ -330,8 +330,11 @@ void mainWrapped(int argc, char * * argv)
fileTransferSettings.connectTimeout = 1; fileTransferSettings.connectTimeout = 1;
} }
if (args.refresh) if (args.refresh) {
settings.tarballTtl = 0; settings.tarballTtl = 0;
settings.ttlNegativeNarInfoCache = 0;
settings.ttlPositiveNarInfoCache = 0;
}
args.command->second->prepare(); args.command->second->prepare();
args.command->second->run(); args.command->second->run();