diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 19:39:20 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 19:39:20 +0000 |
| commit | 307c380a91a3575ab2266ed08427d24c7b2d016e (patch) | |
| tree | 68904e4da5fc72ae493726fd5a69403cbd0347e9 /src/sync | |
| parent | 8a64a34e9016cc60cab80ccdd3d8cf9ecb9b4da3 (diff) | |
sync: remove reply kind from sync filters for root events
they are legacy and not root events
Diffstat (limited to 'src/sync')
| -rw-r--r-- | src/sync/filters.rs | 2 | ||||
| -rw-r--r-- | src/sync/mod.rs | 4 | ||||
| -rw-r--r-- | src/sync/self_subscriber.rs | 21 |
3 files changed, 12 insertions, 15 deletions
diff --git a/src/sync/filters.rs b/src/sync/filters.rs index 24e9bb2..e508eb2 100644 --- a/src/sync/filters.rs +++ b/src/sync/filters.rs | |||
| @@ -90,7 +90,7 @@ pub fn tagged_one_of_our_repo_event_filters( | |||
| 90 | /// Batched per 100 event IDs. | 90 | /// Batched per 100 event IDs. |
| 91 | /// | 91 | /// |
| 92 | /// # Arguments | 92 | /// # Arguments |
| 93 | /// * `root_events` - Set of event IDs (1617/1618/1619/1621 root events) | 93 | /// * `root_events` - Set of event IDs (1617/1618/1621 root events) |
| 94 | /// * `since` - Optional timestamp for incremental sync | 94 | /// * `since` - Optional timestamp for incremental sync |
| 95 | /// | 95 | /// |
| 96 | /// # Returns | 96 | /// # Returns |
diff --git a/src/sync/mod.rs b/src/sync/mod.rs index fb59b3c..50d4ae5 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs | |||
| @@ -72,7 +72,7 @@ pub type PendingSyncIndex = Arc<RwLock<HashMap<String, Vec<PendingBatch>>>>; | |||
| 72 | pub struct RepoSyncNeeds { | 72 | pub struct RepoSyncNeeds { |
| 73 | /// Relay URLs listed in this repo's 30617 announcement | 73 | /// Relay URLs listed in this repo's 30617 announcement |
| 74 | pub relays: HashSet<String>, | 74 | pub relays: HashSet<String>, |
| 75 | /// Root event IDs - 1617/1618/1619/1621 - that reference this repo | 75 | /// Root event IDs - 1617/1618/1621 - that reference this repo |
| 76 | pub root_events: HashSet<EventId>, | 76 | pub root_events: HashSet<EventId>, |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -1633,7 +1633,7 @@ impl SyncManager { | |||
| 1633 | /// | 1633 | /// |
| 1634 | /// Confirmed filter counts: | 1634 | /// Confirmed filter counts: |
| 1635 | /// - Layer 1: 1 filter (announcement subscription) | 1635 | /// - Layer 1: 1 filter (announcement subscription) |
| 1636 | /// - Layer 2: 3 filters per 100-repo chunk (for kinds 1617/1618/1619/1621) | 1636 | /// - Layer 2: 3 filters per 100-repo chunk (for kinds 1617/1618/1621) |
| 1637 | /// - Layer 3: 3 filters per 100-event chunk (for replies/reactions/etc) | 1637 | /// - Layer 3: 3 filters per 100-event chunk (for replies/reactions/etc) |
| 1638 | async fn get_filter_count(&self, relay_url: &str) -> usize { | 1638 | async fn get_filter_count(&self, relay_url: &str) -> usize { |
| 1639 | // Count pending subscriptions | 1639 | // Count pending subscriptions |
diff --git a/src/sync/self_subscriber.rs b/src/sync/self_subscriber.rs index e29e45b..0379fe4 100644 --- a/src/sync/self_subscriber.rs +++ b/src/sync/self_subscriber.rs | |||
| @@ -84,7 +84,6 @@ impl PendingUpdates { | |||
| 84 | /// - 30617 (Repository Announcements) - to discover repos listing our relay | 84 | /// - 30617 (Repository Announcements) - to discover repos listing our relay |
| 85 | /// - 1617 (Patches) - root events referencing repos | 85 | /// - 1617 (Patches) - root events referencing repos |
| 86 | /// - 1618 (Issues) - root events referencing repos | 86 | /// - 1618 (Issues) - root events referencing repos |
| 87 | /// - 1619 (Replies) - root events referencing repos | ||
| 88 | /// - 1621 (PRs) - root events referencing repos | 87 | /// - 1621 (PRs) - root events referencing repos |
| 89 | /// | 88 | /// |
| 90 | /// Note: 30618 is NOT subscribed to here (per v4 spec - only synced from remote relays) | 89 | /// Note: 30618 is NOT subscribed to here (per v4 spec - only synced from remote relays) |
| @@ -159,7 +158,7 @@ impl SelfSubscriber { | |||
| 159 | if let Some(repo_id) = Self::extract_repo_id(&event) { | 158 | if let Some(repo_id) = Self::extract_repo_id(&event) { |
| 160 | let relays = Self::extract_relay_urls(&event); | 159 | let relays = Self::extract_relay_urls(&event); |
| 161 | // 30617 announcements don't contribute to root_events - those are | 160 | // 30617 announcements don't contribute to root_events - those are |
| 162 | // the 1617/1618/1619/1621 event IDs that get added when we receive | 161 | // the 1617/1618/1621 event IDs that get added when we receive |
| 163 | // root events via handle_root_event. See mod.rs:71 for details. | 162 | // root events via handle_root_event. See mod.rs:71 for details. |
| 164 | pending.add_repo(repo_id.clone(), relays.clone(), HashSet::new()); | 163 | pending.add_repo(repo_id.clone(), relays.clone(), HashSet::new()); |
| 165 | tracing::info!( | 164 | tracing::info!( |
| @@ -171,7 +170,7 @@ impl SelfSubscriber { | |||
| 171 | ); | 170 | ); |
| 172 | } | 171 | } |
| 173 | } else { | 172 | } else { |
| 174 | // For root event kinds (1617, 1618, 1619, 1621), | 173 | // For root event kinds (1617, 1618, 1621), |
| 175 | // process them to update the RepoSyncIndex AND add to pending | 174 | // process them to update the RepoSyncIndex AND add to pending |
| 176 | // for Layer 3 filter creation | 175 | // for Layer 3 filter creation |
| 177 | tracing::trace!( | 176 | tracing::trace!( |
| @@ -246,7 +245,7 @@ impl SelfSubscriber { | |||
| 246 | } | 245 | } |
| 247 | } | 246 | } |
| 248 | 247 | ||
| 249 | // For other kinds (1617, 1618, 1619, 1621), we'd need to look at | 248 | // For other kinds (1617, 1618, 1621), we'd need to look at |
| 250 | // their 'a' tags to find which repo they belong to. | 249 | // their 'a' tags to find which repo they belong to. |
| 251 | // That processing happens in the batch processing, not here. | 250 | // That processing happens in the batch processing, not here. |
| 252 | None | 251 | None |
| @@ -285,7 +284,7 @@ impl SelfSubscriber { | |||
| 285 | client.connect().await; | 284 | client.connect().await; |
| 286 | 285 | ||
| 287 | // Subscribe to announcement and root event kinds | 286 | // Subscribe to announcement and root event kinds |
| 288 | // Per v4 spec: 30617, 1617, 1618, 1619, 1621 (NOT 30618) | 287 | // Per v4 spec: 30617, 1617, 1618, 1621 (NOT 30618) |
| 289 | // Check if we have a last_connected time for reconnect filtering | 288 | // Check if we have a last_connected time for reconnect filtering |
| 290 | let filter = if let Some(last) = self.last_connected { | 289 | let filter = if let Some(last) = self.last_connected { |
| 291 | // Quick reconnect - use since filter (15 min buffer) | 290 | // Quick reconnect - use since filter (15 min buffer) |
| @@ -298,9 +297,8 @@ impl SelfSubscriber { | |||
| 298 | .kinds(vec![ | 297 | .kinds(vec![ |
| 299 | Kind::Custom(30617), // Repository Announcements | 298 | Kind::Custom(30617), // Repository Announcements |
| 300 | Kind::Custom(1617), // Patches | 299 | Kind::Custom(1617), // Patches |
| 301 | Kind::Custom(1618), // Issues | 300 | Kind::Custom(1621), // Issues |
| 302 | Kind::Custom(1619), // Replies/Status | 301 | Kind::Custom(1618), // Pull Requests |
| 303 | Kind::Custom(1621), // Pull Requests | ||
| 304 | ]) | 302 | ]) |
| 305 | .since(since) | 303 | .since(since) |
| 306 | } else { | 304 | } else { |
| @@ -308,9 +306,8 @@ impl SelfSubscriber { | |||
| 308 | Filter::new().kinds(vec![ | 306 | Filter::new().kinds(vec![ |
| 309 | Kind::Custom(30617), // Repository Announcements | 307 | Kind::Custom(30617), // Repository Announcements |
| 310 | Kind::Custom(1617), // Patches | 308 | Kind::Custom(1617), // Patches |
| 311 | Kind::Custom(1618), // Issues | 309 | Kind::Custom(1621), // Issues |
| 312 | Kind::Custom(1619), // Replies/Status | 310 | Kind::Custom(1618), // Pull Requests |
| 313 | Kind::Custom(1621), // Pull Requests | ||
| 314 | ]) | 311 | ]) |
| 315 | }; | 312 | }; |
| 316 | 313 | ||
| @@ -378,7 +375,7 @@ impl SelfSubscriber { | |||
| 378 | tracing::info!("SelfSubscriber stopped"); | 375 | tracing::info!("SelfSubscriber stopped"); |
| 379 | } | 376 | } |
| 380 | 377 | ||
| 381 | /// Handle a root event (1617/1618/1619/1621) | 378 | /// Handle a root event (1617/1618/1621) |
| 382 | /// | 379 | /// |
| 383 | /// Extracts the 'a' tag to find the repo addressable reference, | 380 | /// Extracts the 'a' tag to find the repo addressable reference, |
| 384 | /// then updates the RepoSyncIndex with the event ID AND adds to pending | 381 | /// then updates the RepoSyncIndex with the event ID AND adds to pending |