chore: Remove more blocking io calls
This commit is contained in:
parent
1aec9ad9c0
commit
f1ca73d3d2
14 changed files with 427 additions and 357 deletions
34
src/main.rs
34
src/main.rs
|
|
@ -553,21 +553,19 @@ async fn main() -> Result<()> {
|
|||
{
|
||||
bail!("--channels-only does not accept --api-key, --provider, --model, or --memory");
|
||||
}
|
||||
let config = tokio::task::spawn_blocking(move || {
|
||||
if channels_only {
|
||||
onboard::run_channels_repair_wizard()
|
||||
} else if interactive {
|
||||
onboard::run_wizard()
|
||||
} else {
|
||||
onboard::run_quick_setup(
|
||||
api_key.as_deref(),
|
||||
provider.as_deref(),
|
||||
model.as_deref(),
|
||||
memory.as_deref(),
|
||||
)
|
||||
}
|
||||
})
|
||||
.await??;
|
||||
let config = if channels_only {
|
||||
onboard::run_channels_repair_wizard().await
|
||||
} else if interactive {
|
||||
onboard::run_wizard().await
|
||||
} else {
|
||||
onboard::run_quick_setup(
|
||||
api_key.as_deref(),
|
||||
provider.as_deref(),
|
||||
model.as_deref(),
|
||||
memory.as_deref(),
|
||||
)
|
||||
.await
|
||||
}?;
|
||||
// Auto-start channels if user said yes during wizard
|
||||
if std::env::var("ZEROCLAW_AUTOSTART_CHANNELS").as_deref() == Ok("1") {
|
||||
channels::start_channels(config).await?;
|
||||
|
|
@ -576,7 +574,7 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
|
||||
// All other commands need config loaded first
|
||||
let mut config = Config::load_or_init()?;
|
||||
let mut config = Config::load_or_init().await?;
|
||||
config.apply_env_overrides();
|
||||
|
||||
match cli.command {
|
||||
|
|
@ -764,7 +762,7 @@ async fn main() -> Result<()> {
|
|||
Commands::Channel { channel_command } => match channel_command {
|
||||
ChannelCommands::Start => channels::start_channels(config).await,
|
||||
ChannelCommands::Doctor => channels::doctor_channels(config).await,
|
||||
other => channels::handle_command(other, &config),
|
||||
other => channels::handle_command(other, &config).await,
|
||||
},
|
||||
|
||||
Commands::Integrations {
|
||||
|
|
@ -786,7 +784,7 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
|
||||
Commands::Peripheral { peripheral_command } => {
|
||||
peripherals::handle_command(peripheral_command.clone(), &config)
|
||||
peripherals::handle_command(peripheral_command.clone(), &config).await
|
||||
}
|
||||
|
||||
Commands::Config { config_command } => match config_command {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue