refactor: replace blocking std::fs and TCP I/O with async tokio equivalents
- R6: Convert 6 std::fs calls in session.rs to tokio::fs async - R7: Convert std::fs::read_to_string in docker_packages.rs to async - R8: Convert 3 std::fs calls in port_allocator.rs to async, switch to tokio::sync::Mutex - R9+R10+R11: Fix blocking I/O in node_message.rs and nostr_discovery.rs - R12: Convert electrs_status.rs from sync TCP to async tokio::net with 5s timeouts - R4+R5: Spawn periodic cleanup tasks for endpoint and login rate limiters Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
38dc845f57
commit
4d17c60da7
@@ -51,12 +51,9 @@ async fn load_or_create_nostr_keys(identity_dir: &Path) -> Result<Keys> {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
tokio::task::spawn_blocking(move || {
|
||||
std::fs::set_permissions(secret_path, std::fs::Permissions::from_mode(0o600))
|
||||
})
|
||||
.await
|
||||
.context("spawn_blocking")?
|
||||
.context("Failed to set Nostr key permissions")?;
|
||||
fs::set_permissions(&secret_path, std::fs::Permissions::from_mode(0o600))
|
||||
.await
|
||||
.context("Failed to set Nostr key permissions")?;
|
||||
}
|
||||
fs::write(&pub_path, keys.public_key().to_hex())
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user