diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-23 11:17:10 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-23 12:05:29 +0000 |
| commit | 70749ea9df1f6061c332112c617b615f91d79d48 (patch) | |
| tree | 6f4ace061681d8356ea79eb782fddb36c1f31d23 /src/main.rs | |
| parent | 9f15929b10825c2f55434a98794fc551794cad2b (diff) | |
fix: re-process hot-cache maintainer announcements after git push promotion
When an owner announcement is promoted from purgatory via a git push,
any maintainer announcements sitting in the rejected_events_index hot
cache were never re-processed. The invalidate_and_get call only existed
in SyncManager::process_event_static (the nostr sync path); the git push
promotion path (http -> handlers -> git::sync) had no access to the
rejected_events_index at all.
Thread rejected_events_index and write_policy through the git push path:
- process_purgatory_announcements: after saving the promoted announcement,
parse its maintainers tag and call invalidate_and_get() for each, then
re-process any returned hot-cache events via admit_event + save
- process_newly_available_git_data: accept optional write_policy and
rejected_events_index, pass them through to process_purgatory_announcements
- handle_receive_pack: accept Arc<Nip34WritePolicy> and
Arc<RejectedEventsIndex>, pass them to process_newly_available_git_data
- HttpService / run_server: carry the two new fields, clone into each
handle_receive_pack call
- main.rs: obtain rejected_events_index from sync_manager before moving
it into its task; wrap write_policy in Arc for the HTTP server
- RealSyncContext::process_newly_available_git_data: pass None for both
new params (purgatory sync path already handles this via
SyncManager::process_event_static)
Also rewrite the maintainer_reprocessing integration tests to correctly
exercise the hot-cache path now that announcements require git data
before being released from purgatory:
- Start relay_b with relay_a as bootstrap so its SyncManager syncs
maintainer announcements via negentropy before the owner git push
- Use push_unique_git_data_to_relay (new helper) to give each maintainer
a distinct commit hash, preventing git from skipping pack transfer
- Make wait_for_event_on_relay poll in a retry loop so transient timing
gaps between DB write and query do not cause false negatives
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index ab6ede7..6769cf3 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -130,7 +130,9 @@ async fn main() -> Result<()> { | |||
| 130 | } | 130 | } |
| 131 | 131 | ||
| 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 | // and for the HTTP server's git push path (hot-cache re-processing) | ||
| 133 | let shutdown_rejected_index = sync_manager.rejected_events_index(); | 134 | let shutdown_rejected_index = sync_manager.rejected_events_index(); |
| 135 | let http_rejected_index = shutdown_rejected_index.clone(); | ||
| 134 | 136 | ||
| 135 | tokio::spawn(async move { | 137 | tokio::spawn(async move { |
| 136 | sync_manager.run().await; | 138 | sync_manager.run().await; |
| @@ -206,6 +208,9 @@ async fn main() -> Result<()> { | |||
| 206 | // Start HTTP server with integrated relay and database | 208 | // Start HTTP server with integrated relay and database |
| 207 | info!("Starting HTTP server on {}", config.bind_address); | 209 | info!("Starting HTTP server on {}", config.bind_address); |
| 208 | 210 | ||
| 211 | // Wrap write_policy in Arc for sharing between HTTP server connections | ||
| 212 | let http_write_policy = Arc::new(relay_with_db.write_policy.clone()); | ||
| 213 | |||
| 209 | // Run server until shutdown signal, then cleanup | 214 | // Run server until shutdown signal, then cleanup |
| 210 | tokio::select! { | 215 | tokio::select! { |
| 211 | result = http::run_server( | 216 | result = http::run_server( |
| @@ -214,6 +219,8 @@ async fn main() -> Result<()> { | |||
| 214 | relay_with_db.database, | 219 | relay_with_db.database, |
| 215 | metrics, | 220 | metrics, |
| 216 | purgatory, | 221 | purgatory, |
| 222 | http_write_policy, | ||
| 223 | http_rejected_index, | ||
| 217 | ) => { | 224 | ) => { |
| 218 | result? | 225 | result? |
| 219 | } | 226 | } |