Only generate as many symlinks as we need (rather than 27 years worth)
[rapid-gossip-sync-server] / 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