Reduce max age for stale temporary snapshots

The previous fix that implemented cleanup of temporary snapshots
included a max age for stale temporary snapshots, which was originally
set to 24h.

This improved the situation, but it still meant that the app could
accumulate 24 old snapshots, which leads to a non-trivial storage
amount.

This commit changes that to 30 minutes for better storage efficiency.

The previous fix was not published on the App Store yet, so no changelog
entry is needed.

Closes: https://github.com/damus-io/damus/issues/3696
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
Daniel D’Aquino
2026-03-18 12:07:55 -07:00
parent 69ba4b2c38
commit 96eb780f11
@@ -25,7 +25,7 @@ actor DatabaseSnapshotManager {
private static let temporarySnapshotDirectoryPrefix = "snapshot_temp_" private static let temporarySnapshotDirectoryPrefix = "snapshot_temp_"
/// Maximum age for temporary snapshot directories before they are considered stale. /// Maximum age for temporary snapshot directories before they are considered stale.
private static let staleTemporarySnapshotLifetime: TimeInterval = 60 * 60 * 24 private static let staleTemporarySnapshotLifetime: TimeInterval = 60 * 30 // 30 minutes
/// Key for storing last snapshot timestamp in UserDefaults /// Key for storing last snapshot timestamp in UserDefaults
private static let lastSnapshotDateKey = "lastDatabaseSnapshotDate" private static let lastSnapshotDateKey = "lastDatabaseSnapshotDate"