upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/git/sync.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/git/sync.rs')
-rw-r--r--src/git/sync.rs45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/git/sync.rs b/src/git/sync.rs
index 0d9a6b5..9a02ad4 100644
--- a/src/git/sync.rs
+++ b/src/git/sync.rs
@@ -38,8 +38,8 @@ use tracing::{debug, info, warn};
38use nostr_sdk::Event; 38use nostr_sdk::Event;
39 39
40use crate::git::authorization::{ 40use crate::git::authorization::{
41 collect_authorized_maintainers, fetch_repository_data, fetch_repository_data_with_purgatory, 41 collect_authorized_maintainers, fetch_repository_data_excluding_purgatory,
42 RepositoryData, 42 fetch_repository_data_with_purgatory, RepositoryData,
43}; 43};
44use crate::git::{self, oid_exists}; 44use crate::git::{self, oid_exists};
45use crate::nostr::builder::{Nip34WritePolicy, SharedDatabase}; 45use crate::nostr::builder::{Nip34WritePolicy, SharedDatabase};
@@ -933,20 +933,21 @@ async fn process_purgatory_state_events(
933 // IMPORTANT: Use fetch_repository_data_with_purgatory to include announcements 933 // IMPORTANT: Use fetch_repository_data_with_purgatory to include announcements
934 // that may still be in purgatory (not yet promoted). This ensures authorization 934 // that may still be in purgatory (not yet promoted). This ensures authorization
935 // works correctly even if the announcement promotion happens in the same batch. 935 // works correctly even if the announcement promotion happens in the same batch.
936 let mut db_repo_data = match fetch_repository_data_with_purgatory(database, purgatory, identifier).await { 936 let mut db_repo_data =
937 Ok(data) => data, 937 match fetch_repository_data_with_purgatory(database, purgatory, identifier).await {
938 Err(e) => { 938 Ok(data) => data,
939 warn!( 939 Err(e) => {
940 identifier = %identifier, 940 warn!(
941 error = %e, 941 identifier = %identifier,
942 "Failed to fetch repository data for purgatory state events" 942 error = %e,
943 ); 943 "Failed to fetch repository data for purgatory state events"
944 result 944 );
945 .errors 945 result
946 .push(format!("Failed to fetch repo data: {}", e)); 946 .errors
947 return result; 947 .push(format!("Failed to fetch repo data: {}", e));
948 } 948 return result;
949 }; 949 }
950 };
950 951
951 // Process each state event in chronological order 952 // Process each state event in chronological order
952 for entry in &purgatory_states { 953 for entry in &purgatory_states {
@@ -1231,7 +1232,7 @@ async fn process_purgatory_pr_events(
1231 // NOTE: Only fetch from database, NOT purgatory. PR events should only be 1232 // NOTE: Only fetch from database, NOT purgatory. PR events should only be
1232 // released from purgatory when the announcement has been promoted (validated). 1233 // released from purgatory when the announcement has been promoted (validated).
1233 // This ensures we don't accept PR events for announcements that fail validation. 1234 // This ensures we don't accept PR events for announcements that fail validation.
1234 let db_repo_data = match fetch_repository_data(database, identifier).await { 1235 let db_repo_data = match fetch_repository_data_excluding_purgatory(database, identifier).await {
1235 Ok(data) => data, 1236 Ok(data) => data,
1236 Err(e) => { 1237 Err(e) => {
1237 warn!( 1238 warn!(
@@ -1372,7 +1373,9 @@ async fn process_purgatory_announcements(
1372 error = %e, 1373 error = %e,
1373 "Failed to parse owner pubkey" 1374 "Failed to parse owner pubkey"
1374 ); 1375 );
1375 result.errors.push(format!("Failed to parse owner pubkey: {}", e)); 1376 result
1377 .errors
1378 .push(format!("Failed to parse owner pubkey: {}", e));
1376 return result; 1379 return result;
1377 } 1380 }
1378 }; 1381 };
@@ -1450,10 +1453,8 @@ async fn process_purgatory_announcements(
1450 } 1453 }
1451 1454
1452 // Re-process events from hot cache 1455 // Re-process events from hot cache
1453 let dummy_addr = SocketAddr::new( 1456 let dummy_addr =
1454 IpAddr::V4(Ipv4Addr::LOCALHOST), 1457 SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0);
1455 0,
1456 );
1457 for hot_event in hot_events { 1458 for hot_event in hot_events {
1458 info!( 1459 info!(
1459 event_id = %hot_event.id, 1460 event_id = %hot_event.id,