upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-26 20:38:49 +0530
committerYour Name <you@example.com>2026-05-26 20:38:49 +0530
commit7b1b36b8c7e448d1d170c8c6e1f88bb766163fbb (patch)
tree51fa521b7856423ce586077e5e3b045af3694220 /src
parente435f7d7b4ad4e4b1d3c21c35df5f41ffd642376 (diff)
Fix push_target remote reuse and non-fatal per-repo errors
- git_mirror: reuse existing push_target remote via remote_set_url instead of failing on 'remote already exists' on subsequent cycles - mirror_cycle: catch per-repo errors instead of propagating with ? so one failed clone doesn't abort the remaining 87 repos - Add PLAN.md with bug tracking checklist
Diffstat (limited to 'src')
-rw-r--r--src/git_mirror.rs13
-rw-r--r--src/main.rs16
2 files changed, 24 insertions, 5 deletions
diff --git a/src/git_mirror.rs b/src/git_mirror.rs
index 47c0442..6866de3 100644
--- a/src/git_mirror.rs
+++ b/src/git_mirror.rs
@@ -134,7 +134,18 @@ impl GitMirror {
134 let repo = git2::Repository::open(repo_path) 134 let repo = git2::Repository::open(repo_path)
135 .with_context(|| format!("failed to open bare repo at {:?}", repo_path))?; 135 .with_context(|| format!("failed to open bare repo at {:?}", repo_path))?;
136 136
137 let mut remote = repo.remote("push_target", target_url)?; 137 let remote_name = "push_target";
138
139 match repo.find_remote(remote_name) {
140 Ok(_) => {
141 repo.remote_set_url(remote_name, target_url)?;
142 }
143 Err(_) => {
144 repo.remote(remote_name, target_url)?;
145 }
146 }
147
148 let mut remote = repo.find_remote(remote_name)?;
138 149
139 let mut callbacks = RemoteCallbacks::new(); 150 let mut callbacks = RemoteCallbacks::new();
140 callbacks.credentials(|_url, _username, _allowed| git2::Cred::default()); 151 callbacks.credentials(|_url, _username, _allowed| git2::Cred::default());
diff --git a/src/main.rs b/src/main.rs
index 494342c..3fcd27b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -190,13 +190,21 @@ async fn mirror_cycle(
190 "mirroring to missing servers" 190 "mirroring to missing servers"
191 ); 191 );
192 192
193 mirror.mirror_repo_to_servers(db, repo, &missing).await?; 193 if let Err(e) = mirror.mirror_repo_to_servers(db, repo, &missing).await {
194 nostr_mirror.forward_repo_events(db, repo, servers).await?; 194 tracing::error!(identifier = %repo.identifier, error = %e, "git mirror failed for repo, continuing");
195 }
196
197 if let Err(e) = nostr_mirror.forward_repo_events(db, repo, servers).await {
198 tracing::error!(identifier = %repo.identifier, error = %e, "nostr mirror failed for repo, continuing");
199 }
195 } 200 }
196 201
197 nostr_mirror 202 if let Err(e) = nostr_mirror
198 .sync_all_events(db, &config.npubs, servers) 203 .sync_all_events(db, &config.npubs, servers)
199 .await?; 204 .await
205 {
206 tracing::error!(error = %e, "event sync failed");
207 }
200 208
201 tracing::info!("mirror cycle complete"); 209 tracing::info!("mirror cycle complete");
202 Ok(()) 210 Ok(())