Skip to content

Commit

Permalink
fix(native): Fix build failures caused by new ShutdownMode param (#8514)
Browse files Browse the repository at this point in the history
  • Loading branch information
srh committed Jul 24, 2024
1 parent 544f5ea commit 80d10fd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
10 changes: 7 additions & 3 deletions packages/cubejs-backend-native/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::gateway::{ApiGatewayRouterBuilder, ApiGatewayServer};
use crate::{auth::NodeBridgeAuthService, transport::NodeBridgeTransport};
use async_trait::async_trait;
use cubesql::config::injection::Injector;
use cubesql::config::processing_loop::ShutdownMode;
use cubesql::{
config::{Config, CubeServices},
sql::SqlAuthService,
Expand Down Expand Up @@ -54,8 +55,11 @@ impl NodeCubeServices {
Ok(futures)
}

pub async fn stop_processing_loops(&self) -> Result<(), CubeError> {
self.services.stop_processing_loops().await?;
pub async fn stop_processing_loops(
&self,
shutdown_mode: ShutdownMode,
) -> Result<(), CubeError> {
self.services.stop_processing_loops(shutdown_mode).await?;

if self
.services
Expand All @@ -68,7 +72,7 @@ impl NodeCubeServices {
.injector
.get_service_typed::<dyn ApiGatewayServer>()
.await;
gateway_server.stop_processing().await?;
gateway_server.stop_processing(shutdown_mode).await?;
}

Ok(())
Expand Down
5 changes: 3 additions & 2 deletions packages/cubejs-backend-native/src/gateway/server.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::gateway::{ApiGatewayRouterBuilder, ApiGatewayState};
use async_trait::async_trait;
use cubesql::config::injection::Injector;
use cubesql::config::processing_loop::ProcessingLoop;
use cubesql::config::processing_loop::{ProcessingLoop, ShutdownMode};
use cubesql::CubeError;
use std::sync::Arc;
use tokio::net::TcpListener;
Expand Down Expand Up @@ -85,7 +85,8 @@ impl ProcessingLoop for ApiGatewayServerImpl {
.map_err(|err| CubeError::internal(err.to_string()))
}

async fn stop_processing(&self) -> Result<(), CubeError> {
async fn stop_processing(&self, _mode: ShutdownMode) -> Result<(), CubeError> {
// ShutdownMode was added for Postgres protocol and its use here has not yet been considered.
self.close_socket_tx.send(true)?;
Ok(())
}
Expand Down
11 changes: 2 additions & 9 deletions rust/cubesql/cubesql/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,8 @@ impl From<Box<bincode::ErrorKind>> for CubeError {
}
}

impl
From<tokio::sync::watch::error::SendError<Option<crate::config::processing_loop::ShutdownMode>>>
for CubeError
{
fn from(
v: tokio::sync::watch::error::SendError<
Option<crate::config::processing_loop::ShutdownMode>,
>,
) -> Self {
impl<T> From<tokio::sync::watch::error::SendError<T>> for CubeError {
fn from(v: tokio::sync::watch::error::SendError<T>) -> Self {
CubeError::internal(v.to_string())
}
}
Expand Down

0 comments on commit 80d10fd

Please sign in to comment.