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/self_subscriber.rs | |
| 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/self_subscriber.rs')
| -rw-r--r-- | src/sync/self_subscriber.rs | 21 |
1 files changed, 9 insertions, 12 deletions
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 |