diff options
Diffstat (limited to 'src/git/sync.rs')
| -rw-r--r-- | src/git/sync.rs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/git/sync.rs b/src/git/sync.rs index c24d16b..0d9a6b5 100644 --- a/src/git/sync.rs +++ b/src/git/sync.rs | |||
| @@ -1076,6 +1076,57 @@ async fn process_purgatory_state_events( | |||
| 1076 | event_id = %entry.event.id, | 1076 | event_id = %entry.event.id, |
| 1077 | "Released state event from purgatory" | 1077 | "Released state event from purgatory" |
| 1078 | ); | 1078 | ); |
| 1079 | |||
| 1080 | // Promote purgatory announcements for repos that received OIDs via | ||
| 1081 | // the state event copy above. | ||
| 1082 | // | ||
| 1083 | // process_state_with_git_data copies OIDs from source_repo_path to every | ||
| 1084 | // other owner repo listed in db_repo_data.announcements. When an | ||
| 1085 | // announcement for one of those owners is still in purgatory (e.g. the | ||
| 1086 | // meshman announcement waiting while c03rad0's state event triggered the | ||
| 1087 | // copy), the announcement would never be promoted because | ||
| 1088 | // process_purgatory_announcements only promotes the owner derived from | ||
| 1089 | // source_repo_path. Without this promotion the purgatory expiry timer | ||
| 1090 | // keeps running and eventually deletes the bare repo even though the | ||
| 1091 | // announcement was effectively satisfied. | ||
| 1092 | for announcement in &db_repo_data.announcements { | ||
| 1093 | let target_repo_path = git_data_path.join(announcement.repo_path()); | ||
| 1094 | if target_repo_path == source_repo_path { | ||
| 1095 | // This is the source repo — already handled by | ||
| 1096 | // process_purgatory_announcements called before us. | ||
| 1097 | continue; | ||
| 1098 | } | ||
| 1099 | let owner = &announcement.event.pubkey; | ||
| 1100 | if let Some(ann_event) = purgatory.promote_announcement(owner, identifier) { | ||
| 1101 | match database.save_event(&ann_event).await { | ||
| 1102 | Ok(_) => { | ||
| 1103 | info!( | ||
| 1104 | identifier = %identifier, | ||
| 1105 | owner = %owner, | ||
| 1106 | event_id = %ann_event.id, | ||
| 1107 | "Promoted purgatory announcement for owner whose repo received OIDs via state event copy" | ||
| 1108 | ); | ||
| 1109 | if let Some(relay) = local_relay { | ||
| 1110 | relay.notify_event(ann_event.clone()); | ||
| 1111 | } | ||
| 1112 | result.announcements_released += 1; | ||
| 1113 | } | ||
| 1114 | Err(e) => { | ||
| 1115 | warn!( | ||
| 1116 | identifier = %identifier, | ||
| 1117 | owner = %owner, | ||
| 1118 | event_id = %ann_event.id, | ||
| 1119 | error = %e, | ||
| 1120 | "Failed to save promoted announcement to database" | ||
| 1121 | ); | ||
| 1122 | result.errors.push(format!( | ||
| 1123 | "Failed to save promoted announcement for owner {}: {}", | ||
| 1124 | owner, e | ||
| 1125 | )); | ||
| 1126 | } | ||
| 1127 | } | ||
| 1128 | } | ||
| 1129 | } | ||
| 1079 | } | 1130 | } |
| 1080 | Err(e) => { | 1131 | Err(e) => { |
| 1081 | warn!( | 1132 | warn!( |