Skip to content

Commit 913d731

Browse files
committed
Fix
1 parent e85260f commit 913d731

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

server/src/handlers/livetail.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use futures::future;
66
use futures::stream::BoxStream;
77
use futures_util::{Future, StreamExt, TryFutureExt, TryStreamExt};
88
use http_auth_basic::Credentials;
9+
use rand::distributions::{Alphanumeric, DistString};
910
use tonic::metadata::MetadataMap;
1011
use tonic::transport::Server;
1112
use tonic::{Request, Response, Status, Streaming};
@@ -22,6 +23,7 @@ use crate::livetail::{Message, LIVETAIL};
2223
use crate::metadata::STREAM_INFO;
2324
use crate::rbac::map::SessionKey;
2425
use crate::rbac::{self, Users};
26+
use crate::utils;
2527

2628
use super::SESSION_COOKIE_NAME;
2729

@@ -90,10 +92,15 @@ impl FlightService for FlightServiceImpl {
9092
.schema(stream)
9193
.map_err(|err| Status::failed_precondition(err.to_string()))?;
9294

93-
let rx = LIVETAIL.new_pipe("a".to_string(), stream.to_string());
94-
let rx = rx.filter_map(|x| {
95+
let rx = LIVETAIL.new_pipe(
96+
Alphanumeric.sample_string(&mut rand::thread_rng(), 32),
97+
stream.to_string(),
98+
);
99+
100+
let adapter_schema = schema.clone();
101+
let rx = rx.filter_map(move |x| {
95102
future::ready(match x {
96-
Message::Record(t) => Some(Ok(t)),
103+
Message::Record(t) => Some(Ok(utils::arrow::adapt_batch(&adapter_schema, &t))),
97104
_ => None,
98105
})
99106
});

0 commit comments

Comments
 (0)