upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/sync/self_subscriber.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-23 12:48:26 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-23 12:48:26 +0000
commitf62ef12fb84e2210f9a0a67a5e1e574a8ee66c16 (patch)
treeea457689e8507ae01cbf99fa4c210763f836c7ac /src/sync/self_subscriber.rs
parent49401286ea7413f834197e6a5b221649e10e2ad8 (diff)
refactor: replace inline purgatory sync registration with timer-only approach
Remove the redundant inline kind-30617 registration block from the sync event loop and the three is_generic/recompute_new_sync_filters_for_relay calls from confirm_batch error paths. The purgatory announcement sync timer (run_purgatory_announcement_sync) is now the sole registration path. Consolidate NGIT_SYNC_BATCH_WINDOW_MS and NGIT_PURGATORY_SYNC_INTERVAL_MS into a single NGIT_TEST=1 flag that sets both timers to 200ms, replacing two ad-hoc env vars with one reusable test-mode flag.
Diffstat (limited to 'src/sync/self_subscriber.rs')
-rw-r--r--src/sync/self_subscriber.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sync/self_subscriber.rs b/src/sync/self_subscriber.rs
index 70c3dbf..ab10c49 100644
--- a/src/sync/self_subscriber.rs
+++ b/src/sync/self_subscriber.rs
@@ -126,14 +126,14 @@ impl SelfSubscriber {
126 126
127 /// Get batch window from environment or use default 127 /// Get batch window from environment or use default
128 /// 128 ///
129 /// Reads `NGIT_SYNC_BATCH_WINDOW_MS` environment variable. 129 /// When `NGIT_TEST=1` is set, uses 200ms for faster test execution.
130 /// Default: 5000ms (5 seconds) 130 /// Default: 5000ms (5 seconds)
131 fn get_batch_window() -> Duration { 131 fn get_batch_window() -> Duration {
132 std::env::var("NGIT_SYNC_BATCH_WINDOW_MS") 132 if std::env::var("NGIT_TEST").as_deref() == Ok("1") {
133 .ok() 133 Duration::from_millis(200)
134 .and_then(|s| s.parse::<u64>().ok()) 134 } else {
135 .map(Duration::from_millis) 135 Duration::from_millis(5000)
136 .unwrap_or(Duration::from_millis(5000)) 136 }
137 } 137 }
138 138
139 /// Process a relay pool notification 139 /// Process a relay pool notification