Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinPostma committed Oct 8, 2023
1 parent 197cbde commit f8b920b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
13 changes: 10 additions & 3 deletions sqld/src/connection/write_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ impl WriteProxyConnection {
F: FnOnce(&mut RemoteConnection) -> BoxFuture<'_, crate::Result<Ret>>,
{
let mut remote_conn = self.remote_conn.lock().await;
// TODO: catch broken connection, and reset it to None.
if remote_conn.is_some() {
cb(remote_conn.as_mut().unwrap()).await
} else {
Expand Down Expand Up @@ -471,7 +470,10 @@ pub mod test {
use super::*;
use crate::{
query_result_builder::{test::test_driver, Column, QueryResultBuilderError},
rpc::{proxy::rpc::{query_result::RowResult, ExecuteResults}, streaming_exec::test::random_valid_program_resp},
rpc::{
proxy::rpc::{query_result::RowResult, ExecuteResults},
streaming_exec::test::random_valid_program_resp,
},
};

/// generate an arbitraty rpc value. see build.rs for usage.
Expand Down Expand Up @@ -562,6 +564,11 @@ pub mod test {
builder_config: QueryBuilderConfig::default(),
};

remote.execute(Program::seq(&[]), validator).await.unwrap().0.into_ret();
remote
.execute(Program::seq(&[]), validator)
.await
.unwrap()
.0
.into_ret();
}
}
2 changes: 1 addition & 1 deletion sqld/src/http/user/result_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl QueryResultBuilder for JsonHttpPayloadBuilder {
#[cfg(test)]
mod test {

use crate::query_result_builder::test::{random_transition, fsm_builder_driver};
use crate::query_result_builder::test::{fsm_builder_driver, random_transition};

use super::*;

Expand Down
2 changes: 2 additions & 0 deletions sqld/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ where
let proxy_service =
ProxyService::new(namespaces.clone(), None, self.disable_namespaces);
// Garbage collect proxy clients every 30 seconds
// TODO: this will no longer be necessary once client have adopted the streaming proxy
// protocol
self.join_set.spawn({
let clients = proxy_service.clients();
async move {
Expand Down
7 changes: 5 additions & 2 deletions sqld/src/query_result_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ pub mod test {

trace.push(state);
if state == FsmState::Finish {
break
break;
}

max_steps = max_steps.saturating_sub(1);
Expand Down Expand Up @@ -818,7 +818,10 @@ pub mod test {
Ok(())
}

fn step_error(&mut self, _error: crate::error::Error) -> Result<(), QueryResultBuilderError> {
fn step_error(
&mut self,
_error: crate::error::Error,
) -> Result<(), QueryResultBuilderError> {
assert_eq!(self.trace[self.current], FsmState::StepError);
self.current += 1;
Ok(())
Expand Down
9 changes: 7 additions & 2 deletions sqld/src/rpc/streaming_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ pub mod test {
use crate::auth::{Authorized, Permission};
use crate::connection::libsql::LibSqlConnection;
use crate::connection::program::Program;
use crate::query_result_builder::test::{TestBuilder, ValidateTraceBuilder, random_transition, fsm_builder_driver};
use crate::query_result_builder::test::{
fsm_builder_driver, random_transition, TestBuilder, ValidateTraceBuilder,
};
use crate::rpc::proxy::rpc::StreamProgramReq;

use super::*;
Expand Down Expand Up @@ -615,6 +617,9 @@ pub mod test {
move || fsm_builder_driver(&trace, builder)
});

(ReceiverStream::new(receiver), ValidateTraceBuilder::new(trace))
(
ReceiverStream::new(receiver),
ValidateTraceBuilder::new(trace),
)
}
}

0 comments on commit f8b920b

Please sign in to comment.