diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-18 20:32:13 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-18 20:32:13 +0000 |
| commit | ee113a654e2971a6ebdb07398cc5638dbe59b48c (patch) | |
| tree | 6e4aacd207553c367d9b533fd6d4824d34994c82 /src/main.rs | |
| parent | e7e61d1abfb3609c6818e6040294c6be19ba805f (diff) | |
fix: replace repo_sync_index wiring with purgatory announcement sync timer
Instead of threading repo_sync_index through PolicyContext/builder.rs/main.rs
to handle user-submitted purgatory announcements, add a simple background
timer (run_purgatory_announcement_sync, every 5s) that scans the purgatory
for announcement entries and registers them in repo_sync_index as StateOnly.
This is simpler and covers both flows:
- Sync-path announcements: inline registration still happens during event
processing (sync/mod.rs:1839+), timer provides a safety net
- User-submitted announcements: SelfSubscriber never sees them (rejected
from DB), timer is the primary registration path
The timer calls sync_purgatory_announcements_to_index() which:
1. Snapshots purgatory via new announcements_for_sync() public method
2. Or_inserts StateOnly entries (never downgrades Full entries)
3. Detects newly added relay URLs and calls handle_new_sync_filters to
connect and subscribe - fixing the failing test that expected relay
discovery from a user-submitted purgatory announcement
Removes: repo_sync_index field from PolicyContext, set/get_repo_sync_index
methods, set_repo_sync_index on Nip34WritePolicy, wiring in main.rs, and
the inline AcceptPurgatory registration block in builder.rs.
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index ebe05a3..ab6ede7 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -132,13 +132,6 @@ async fn main() -> Result<()> { | |||
| 132 | // Get a reference to the rejected events index for shutdown persistence | 132 | // Get a reference to the rejected events index for shutdown persistence |
| 133 | let shutdown_rejected_index = sync_manager.rejected_events_index(); | 133 | let shutdown_rejected_index = sync_manager.rejected_events_index(); |
| 134 | 134 | ||
| 135 | // Wire repo_sync_index into write policy so user-submitted purgatory announcements | ||
| 136 | // get registered for state event sync immediately (Fix 3). | ||
| 137 | let repo_sync_index = sync_manager.repo_sync_index(); | ||
| 138 | relay_with_db | ||
| 139 | .write_policy | ||
| 140 | .set_repo_sync_index(repo_sync_index); | ||
| 141 | |||
| 142 | tokio::spawn(async move { | 135 | tokio::spawn(async move { |
| 143 | sync_manager.run().await; | 136 | sync_manager.run().await; |
| 144 | }); | 137 | }); |