Skip to content

Commit 1ac2dc4

Browse files
changed to thread::spawn
1 parent b4c3d88 commit 1ac2dc4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/handlers/http/query.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use serde_json::{json, Value};
3131
use std::collections::HashMap;
3232
use std::pin::Pin;
3333
use std::sync::Arc;
34+
use std::thread;
3435
use std::time::Instant;
3536
use tracing::error;
3637

@@ -154,10 +155,13 @@ async fn execute_query(
154155
query: LogicalQuery,
155156
stream_name: String,
156157
) -> Result<(Vec<RecordBatch>, Vec<String>), QueryError> {
157-
match tokio::task::spawn_blocking(move || query.execute(stream_name)).await {
158-
Ok(Ok(result)) => Ok(result),
159-
Ok(Err(e)) => Err(QueryError::Execute(e)),
160-
Err(e) => Err(QueryError::Anyhow(anyhow::Error::msg(e.to_string()))),
158+
let handle = thread::spawn(move || query.execute(stream_name));
159+
match handle.join() {
160+
Ok(result) => match result {
161+
Ok(r) => Ok(r),
162+
Err(e) => Err(QueryError::Execute(e)),
163+
},
164+
Err(_) => Err(QueryError::Anyhow(anyhow::Error::msg("unable to join"))),
161165
}
162166
}
163167

0 commit comments

Comments
 (0)