Skip to content

Commit

Permalink
chore(starknet_sequencer_infra): warn on clients and servers being dr…
Browse files Browse the repository at this point in the history
…opped

commit-id:98e56d1a
  • Loading branch information
Itay-Tsabary-Starkware committed Dec 18, 2024
1 parent 6683fd5 commit e43d797
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use async_trait::async_trait;
use serde::de::DeserializeOwned;
use serde::Serialize;
use tokio::sync::mpsc::{channel, Sender};
use tracing::info;
use tracing::warn;

use crate::component_client::ClientResult;
use crate::component_definitions::{ComponentClient, ComponentRequestAndResponseSender};
Expand Down Expand Up @@ -103,7 +103,7 @@ where
Response: Send + Sync,
{
fn drop(&mut self) {
info!("Dropping LocalComponentClient {}.", type_name::<Self>());
warn!("Dropping {}.", type_name::<Self>());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::marker::PhantomData;

use async_trait::async_trait;
use tokio::sync::mpsc::Receiver;
use tracing::{debug, error, info};
use tracing::{debug, error, info, warn};

use crate::component_definitions::{
ComponentRequestAndResponseSender,
Expand Down Expand Up @@ -203,6 +203,19 @@ where
}
}

// TODO(Tsabary): Replace with `type_name` with `short_type_name`.
impl<Component, Request, Response, LocalServerType> Drop
for BaseLocalComponentServer<Component, Request, Response, LocalServerType>
where
Component: ComponentRequestHandler<Request, Response>,
Request: Send + Sync,
Response: Send + Sync,
{
fn drop(&mut self) {
warn!("Dropping {}.", type_name::<Self>());
}
}

async fn request_response_loop<Request, Response, Component>(
rx: &mut Receiver<ComponentRequestAndResponseSender<Request, Response>>,
component: &mut Component,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::any::type_name;
use std::fmt::Debug;
use std::net::SocketAddr;
use std::sync::Arc;
Expand All @@ -9,6 +10,7 @@ use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request as HyperRequest, Response as HyperResponse, Server, StatusCode};
use serde::de::DeserializeOwned;
use serde::Serialize;
use tracing::warn;

use crate::component_client::{ClientError, LocalComponentClient};
use crate::component_definitions::{
Expand Down Expand Up @@ -191,3 +193,14 @@ where
Ok(())
}
}

// TODO(Tsabary): Replace with `type_name` with `short_type_name`.
impl<Request, Response> Drop for RemoteComponentServer<Request, Response>
where
Request: Serialize + DeserializeOwned + Send + Sync + 'static,
Response: Serialize + DeserializeOwned + Send + Sync + 'static,
{
fn drop(&mut self) {
warn!("Dropping {}.", type_name::<Self>());
}
}

0 comments on commit e43d797

Please sign in to comment.