From 1ced15a2098f1469b2dd7d59636fdcdc710efc22 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 29 Oct 2023 17:22:23 +0800 Subject: feat: autodetect light theme on unix-like os (#168) --- src/client/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/client') diff --git a/src/client/mod.rs b/src/client/mod.rs index 37440f1..b2ceb84 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -11,7 +11,6 @@ use async_trait::async_trait; use reqwest::{ClientBuilder, Proxy}; use serde::Deserialize; use std::{env, time::Duration}; -use tokio::runtime::Runtime; use tokio::time::sleep; use crate::{ @@ -64,7 +63,7 @@ pub trait Client { fn get_config(&self) -> &SharedConfig; fn send_message(&self, content: &str) -> Result { - init_runtime()?.block_on(async { + init_tokio_runtime()?.block_on(async { if self.get_config().read().dry_run { return Ok(self.get_config().read().echo_messages(content)); } @@ -88,7 +87,7 @@ pub trait Client { } } let abort = handler.get_abort(); - init_runtime()?.block_on(async { + init_tokio_runtime()?.block_on(async { tokio::select! { ret = async { if self.get_config().read().dry_run { @@ -164,7 +163,7 @@ pub fn list_models(config: &Config) -> Vec { .collect() } -pub fn init_runtime() -> Result { +pub fn init_tokio_runtime() -> Result { tokio::runtime::Builder::new_current_thread() .enable_all() .build() -- cgit v1.2.3