chore: Remove more blocking io calls
This commit is contained in:
parent
1aec9ad9c0
commit
f1ca73d3d2
14 changed files with 427 additions and 357 deletions
|
|
@ -1117,7 +1117,7 @@ fn normalize_telegram_identity(value: &str) -> String {
|
|||
value.trim().trim_start_matches('@').to_string()
|
||||
}
|
||||
|
||||
fn bind_telegram_identity(config: &Config, identity: &str) -> Result<()> {
|
||||
async fn bind_telegram_identity(config: &Config, identity: &str) -> Result<()> {
|
||||
let normalized = normalize_telegram_identity(identity);
|
||||
if normalized.is_empty() {
|
||||
anyhow::bail!("Telegram identity cannot be empty");
|
||||
|
|
@ -1147,7 +1147,7 @@ fn bind_telegram_identity(config: &Config, identity: &str) -> Result<()> {
|
|||
}
|
||||
|
||||
telegram.allowed_users.push(normalized.clone());
|
||||
updated.save()?;
|
||||
updated.save().await?;
|
||||
println!("✅ Bound Telegram identity: {normalized}");
|
||||
println!(" Saved to {}", updated.config_path.display());
|
||||
match maybe_restart_managed_daemon_service() {
|
||||
|
|
@ -1243,7 +1243,7 @@ fn maybe_restart_managed_daemon_service() -> Result<bool> {
|
|||
Ok(false)
|
||||
}
|
||||
|
||||
pub fn handle_command(command: crate::ChannelCommands, config: &Config) -> Result<()> {
|
||||
pub async fn handle_command(command: crate::ChannelCommands, config: &Config) -> Result<()> {
|
||||
match command {
|
||||
crate::ChannelCommands::Start => {
|
||||
anyhow::bail!("Start must be handled in main.rs (requires async runtime)")
|
||||
|
|
@ -1290,7 +1290,7 @@ pub fn handle_command(command: crate::ChannelCommands, config: &Config) -> Resul
|
|||
anyhow::bail!("Remove channel '{name}' — edit ~/.zeroclaw/config.toml directly");
|
||||
}
|
||||
crate::ChannelCommands::BindTelegram { identity } => {
|
||||
bind_telegram_identity(config, &identity)
|
||||
bind_telegram_identity(config, &identity).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue