chore: remove unnecessary logging (#6377)

This commit is contained in:
Taiming Liu
2025-03-24 22:14:37 +08:00
committed by GitHub
parent 6352357ea2
commit bb3dfd5bef
4 changed files with 9 additions and 28 deletions
+2 -9
View File
@@ -271,18 +271,11 @@ SELECT * FROM pipeline WHERE org = ? AND source_type = ? AND stream_org = ? AND
async fn get_by_id(&self, pipeline_id: &str) -> Result<Pipeline> {
let pool = CLIENT_RO.clone();
let query = r#"SELECT * FROM pipeline WHERE id = ?;"#;
let pipeline = match sqlx::query_as::<_, Pipeline>(query)
sqlx::query_as::<_, Pipeline>(query)
.bind(pipeline_id)
.fetch_one(&pool)
.await
{
Ok(pipeline) => pipeline,
Err(e) => {
log::debug!("[MYSQL] get pipeline by id error: {}", e);
return Err(Error::from(DbError::KeyNotExists(pipeline_id.to_string())));
}
};
Ok(pipeline)
.map_err(|_| Error::from(DbError::KeyNotExists(pipeline_id.to_string())))
}
async fn get_with_same_source_stream(&self, pipeline: &Pipeline) -> Result<Pipeline> {
+2 -9
View File
@@ -268,18 +268,11 @@ SELECT * FROM pipeline WHERE org = $1 AND source_type = $2 AND stream_org = $3 A
async fn get_by_id(&self, pipeline_id: &str) -> Result<Pipeline> {
let pool = CLIENT_RO.clone();
let query = "SELECT * FROM pipeline WHERE id = $1;";
let pipeline = match sqlx::query_as::<_, Pipeline>(query)
sqlx::query_as::<_, Pipeline>(query)
.bind(pipeline_id)
.fetch_one(&pool)
.await
{
Ok(pipeline) => pipeline,
Err(e) => {
log::error!("[POSTGRES] get pipeline by id error: {}", e);
return Err(Error::from(DbError::KeyNotExists(pipeline_id.to_string())));
}
};
Ok(pipeline)
.map_err(|_| Error::from(DbError::KeyNotExists(pipeline_id.to_string())))
}
async fn get_with_same_source_stream(&self, pipeline: &Pipeline) -> Result<Pipeline> {
+2 -9
View File
@@ -270,18 +270,11 @@ SELECT * FROM pipeline WHERE org = $1 AND source_type = $2 AND stream_org = $3 A
async fn get_by_id(&self, pipeline_id: &str) -> Result<Pipeline> {
let pool = CLIENT_RO.clone();
let query = "SELECT * FROM pipeline WHERE id = $1;";
let pipeline = match sqlx::query_as::<_, Pipeline>(query)
sqlx::query_as::<_, Pipeline>(query)
.bind(pipeline_id)
.fetch_one(&pool)
.await
{
Ok(pipeline) => pipeline,
Err(e) => {
log::error!("[SQLITE] get pipeline by id error: {}", e);
return Err(Error::from(DbError::KeyNotExists(pipeline_id.to_string())));
}
};
Ok(pipeline)
.map_err(|_| Error::from(DbError::KeyNotExists(pipeline_id.to_string())))
}
async fn get_with_same_source_stream(&self, pipeline: &Pipeline) -> Result<Pipeline> {
+3 -1
View File
@@ -146,7 +146,9 @@ pub async fn list(
pub async fn delete(org_id: &str, name: &str) -> Result<(), DestinationError> {
let cacher = ALERTS.read().await;
for (stream_key, (_, alert)) in cacher.iter() {
if stream_key.starts_with(&format!("{}/", org_id)) && alert.destinations.contains(&name.to_string()) {
if stream_key.starts_with(&format!("{}/", org_id))
&& alert.destinations.contains(&name.to_string())
{
return Err(DestinationError::UsedByAlert(alert.name.to_string()));
}
}