upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-03 14:50:22 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-03 15:18:23 +0000
commit874a8abe1d076cfafd9baf919ec23d7d58200698 (patch)
treedce0d0d36bddc496ff32f8555a8790d8dc7be7e4 /src/main.rs
parent9fd4350c57bbe986ebf65bf3ea4c996572e81884 (diff)
parent92a9a3bfe0bc522e8ae411991a366a3a6310d525 (diff)
Merge relay.ngit.dev migration: bug fixes and migration tooling
This merge includes critical bug fixes and comprehensive migration tooling developed during the relay.ngit.dev migration effort. Bug Fixes: - Fix git protocol error handling to return HTTP 200 with ERR pkt-line - Fix naughty list false positives and DNS failure identification - Fix database query filters in load_existing_events (remove .since()) - Fix OID fetch tracking to distinguish 0 OIDs from successful fetches - Fix purgatory event source tracking for filtered expiry logging - Implement OID retry logic for 'not our ref' errors Migration Tools & Documentation: - Complete 5-phase migration analysis pipeline with orchestration script - Phase 1: Event fetching from source relay - Phase 2: Git sync verification - Phase 3: Categorization and relay comparison - Phase 4: Log extraction (parse failures, purgatory expiry) - Phase 5: Action classification for migration decisions - Comprehensive migration guide with lessons learned - Troubleshooting guide for permission and corruption issues Configuration: - Add NGIT_LOG_LEVEL configuration option - Update git throttle limits to 60/minute - Improve logging throughout for better observability
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs
index 5e5b83a..6c9da05 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,8 +3,8 @@ use std::{path::PathBuf, sync::Arc};
3 3
4use anyhow::Result; 4use anyhow::Result;
5use tokio::signal; 5use tokio::signal;
6use tracing::{error, info, warn, Level}; 6use tracing::{error, info, warn};
7use tracing_subscriber::FmtSubscriber; 7use tracing_subscriber::{EnvFilter, FmtSubscriber};
8 8
9use ngit_grasp::{ 9use ngit_grasp::{
10 config::{Config, DatabaseBackend}, 10 config::{Config, DatabaseBackend},
@@ -17,16 +17,16 @@ use ngit_grasp::{
17 17
18#[tokio::main] 18#[tokio::main]
19async fn main() -> Result<()> { 19async fn main() -> Result<()> {
20 // Initialize tracing 20 // Load configuration first (priority: CLI flags > env vars > .env file > defaults)
21 let config = Config::load()?;
22
23 // Initialize tracing with configured log level
21 let subscriber = FmtSubscriber::builder() 24 let subscriber = FmtSubscriber::builder()
22 .with_max_level(Level::DEBUG) 25 .with_env_filter(EnvFilter::new(&config.log_level))
23 .finish(); 26 .finish();
24 tracing::subscriber::set_global_default(subscriber)?; 27 tracing::subscriber::set_global_default(subscriber)?;
25 28
26 info!("Starting ngit-grasp with nostr-relay-builder..."); 29 info!("Starting ngit-grasp with log level: {}", config.log_level);
27
28 // Load configuration (priority: CLI flags > env vars > .env file > defaults)
29 let config = Config::load()?;
30 30
31 // Validate configuration and fail fast on fatal errors 31 // Validate configuration and fail fast on fatal errors
32 // Recoverable issues (e.g., malformed whitelist entries) are logged as warnings 32 // Recoverable issues (e.g., malformed whitelist entries) are logged as warnings
@@ -187,8 +187,8 @@ async fn main() -> Result<()> {
187 )); 187 ));
188 188
189 // Create throttle manager for rate limiting remote git servers 189 // Create throttle manager for rate limiting remote git servers
190 // Default: 5 concurrent requests per domain, 30 requests per minute per domain 190 // Default: 5 concurrent requests per domain, 60 requests per minute per domain
191 let throttle_manager = Arc::new(ThrottleManager::new(5, 30)); 191 let throttle_manager = Arc::new(ThrottleManager::new(5, 60));
192 throttle_manager.set_context(sync_ctx.clone()); 192 throttle_manager.set_context(sync_ctx.clone());
193 throttle_manager.set_git_naughty_list(git_naughty_list.clone()); 193 throttle_manager.set_git_naughty_list(git_naughty_list.clone());
194 194