An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: add HTTP client timeout to prevent indefinite hangs (MM-89 Issue #6)

reqwest::Client::new() creates a client with no timeout. A hung plc.directory
connection never errors and holds pending_did pre-stored but unregistered forever.

Replace Client::new() with Client::builder().timeout(Duration::from_secs(10)).build()
in:
- main.rs: Production HTTP client initialization
- app.rs: test_state_with_plc_url test helper
- create_did.rs: test_state_for_did test helper

10 second timeout is reasonable for most PLC directory operations.

authored by

Malpercio and committed by
Tangled
30042f1a 4e7c7b75

+13 -2
+7 -1
crates/relay/src/app.rs
··· 125 125 use crate::db::{open_pool, run_migrations}; 126 126 use common::{BlobsConfig, IrohConfig, OAuthConfig, TelemetryConfig}; 127 127 use std::path::PathBuf; 128 + use std::time::Duration; 128 129 129 130 let db = open_pool("sqlite::memory:").await.expect("test pool"); 130 131 run_migrations(&db).await.expect("test migrations"); 132 + 133 + let http_client = Client::builder() 134 + .timeout(Duration::from_secs(10)) 135 + .build() 136 + .expect("test http client"); 131 137 132 138 AppState { 133 139 config: Arc::new(Config { ··· 150 156 plc_directory_url, 151 157 }), 152 158 db, 153 - http_client: Client::new(), 159 + http_client, 154 160 } 155 161 } 156 162
+6 -1
crates/relay/src/main.rs
··· 97 97 ) 98 98 })?; 99 99 100 + let http_client = Client::builder() 101 + .timeout(std::time::Duration::from_secs(10)) 102 + .build() 103 + .expect("failed to build HTTP client"); 104 + 100 105 let state = app::AppState { 101 106 config: Arc::new(config), 102 107 db: pool, 103 - http_client: Client::new(), 108 + http_client, 104 109 }; 105 110 106 111 let listener = tokio::net::TcpListener::bind(&addr)