Skip to content

Commit cc0996d

Browse files
committed
CHG cleanup db helpers
1 parent 55777f9 commit cc0996d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

theia/proxy-rs/src/db.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@ pub async fn get_cluster_address(pool: &MySqlPool, session_id: &str) -> Result<S
1919
.fetch_optional(pool)
2020
.await?;
2121

22-
match row {
23-
Some(session) => {
24-
if let Some(cluster_address) = session.cluster_address {
25-
Ok(cluster_address)
26-
} else {
27-
Err(anyhow::anyhow!("cluster address not found"))
28-
}
29-
}
30-
None => Err(anyhow::anyhow!("session not found")),
22+
if let Some(row) = row {
23+
return row.cluster_address.ok_or_else(|| anyhow::anyhow!("cluster address not found"));
3124
}
25+
26+
Err(anyhow::anyhow!("cluster_address not found"))
3227
}
3328

3429
pub async fn update_last_proxy_time(session_id: &str, pool: &MySqlPool) -> Result<()> {

0 commit comments

Comments
 (0)