Only generate as many symlinks as we need (rather than 27 years worth)
authorMatt Corallo <git@bluematt.me>
Sun, 16 Jul 2023 20:41:00 +0000 (20:41 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 13 Aug 2023 05:31:03 +0000 (05:31 +0000)
src/snapshot.rs

index 96c1e4d28a08c7e6b99ec5c2b12a6f3dfd0ba75b..4a86f9854eb8caa600c30b12a0fddede72311f52 100644 (file)
@@ -105,7 +105,9 @@ impl<L: Deref + Clone> Snapshotter<L> where L::Target: Logger {
                                symlink(&relative_dummy_snapshot_path, &dummy_symlink_path).unwrap();
                        }
 
-                       for i in 0..10_001u64 {
+                       // Number of intervals since Jan 1, 2022, a few months before RGS server was released.
+                       let symlink_count = (reference_timestamp - 1640995200) / config::SNAPSHOT_CALCULATION_INTERVAL as u64;
+                       for i in 0..symlink_count {
                                // let's create non-dummy-symlinks
 
                                // first, determine which snapshot range should be referenced