fix(core): Fix async panic on blocking #19

Replaced internal threads with tokio spawn functions
This commit is contained in:
2023-02-20 10:10:42 +01:00
committed by Kasper Juul Hermansen
parent 45d6462037
commit 75bc17e57d
21 changed files with 66 additions and 61 deletions

View File

@@ -17,12 +17,12 @@ impl GenerateCommand {
clap::Command::new("generate").arg(Arg::new("output").long("output"))
}
pub fn exec(arg_matches: &ArgMatches) -> eyre::Result<()> {
pub async fn exec(arg_matches: &ArgMatches) -> eyre::Result<()> {
let cfg = Config::default();
let (conn, _proc) = Engine::new().start(&cfg)?;
let (conn, _proc) = Engine::new().start(&cfg).await?;
let session = Session::new();
let req = session.start(&cfg, &conn)?;
let schema = session.schema(req)?;
let schema = session.schema(req).await?;
let code = generate(
schema.into_schema().schema.unwrap(),
Arc::new(RustGenerator {}),