Skip to content

Commit adcff00

Browse files
committed
postrebase fix + better logging
1 parent 45824fa commit adcff00

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

backend/src/services/api.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use super::prelude::*;
1616
),
1717
security(("api_key" = []))
1818
))]
19+
#[tracing::instrument(ret, skip(client), level = "info", fields(method = "GET"))]
1920
pub async fn get_disks_count(Extension(client): Extension<HttpBobClient>) -> Json<DiskCount> {
2021
tracing::info!("get /disks/count : {:?}", client);
2122

@@ -83,6 +84,7 @@ pub async fn get_disks_count(Extension(client): Extension<HttpBobClient>) -> Jso
8384
),
8485
security(("api_key" = []))
8586
))]
87+
#[tracing::instrument(ret, skip(client), level = "info", fields(method = "GET"))]
8688
pub async fn get_nodes_count(Extension(client): Extension<HttpBobClient>) -> Json<NodeCount> {
8789
tracing::info!("get /nodes/count : {:?}", client);
8890

@@ -130,6 +132,7 @@ pub async fn get_nodes_count(Extension(client): Extension<HttpBobClient>) -> Jso
130132
),
131133
security(("api_key" = []))
132134
))]
135+
#[tracing::instrument(ret, skip(client), level = "info", fields(method = "GET"))]
133136
pub async fn get_rps(Extension(client): Extension<HttpBobClient>) -> Json<RPS> {
134137
tracing::info!("get /nodes/rps : {:?}", client);
135138

@@ -168,6 +171,7 @@ pub async fn get_rps(Extension(client): Extension<HttpBobClient>) -> Json<RPS> {
168171
),
169172
security(("api_key" = []))
170173
))]
174+
#[tracing::instrument(ret, skip(client), level = "info", fields(method = "GET"))]
171175
pub async fn get_space(Extension(client): Extension<HttpBobClient>) -> Json<SpaceInfo> {
172176
tracing::info!("get /space : {:?}", client);
173177
let mut spaces: FuturesUnordered<_> = client

backend/src/services/auth.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub async fn login(
6868
Extension(request_timeout): Extension<RequestTimeout>,
6969
Json(bob): Json<BobConnectionData>,
7070
) -> AxumResult<StatusCode> {
71-
let bob_client = BobClient::<HttpClient>::try_new(bob.clone(), request_timeout)
71+
let bob_client = BobClient::<_, HttpClient>::try_new(bob.clone(), request_timeout)
7272
.await
7373
.map_err(|err| {
7474
tracing::error!("{err:?}");
@@ -109,7 +109,13 @@ pub async fn login(
109109
tracing::error!("{err:?}");
110110
StatusCode::UNAUTHORIZED
111111
})?;
112-
auth.client_store.insert(*bob_client.id(), bob_client);
112+
auth.client_store
113+
.save(*bob_client.id(), bob_client)
114+
.await
115+
.map_err(|err| {
116+
tracing::error!("{err:?}");
117+
StatusCode::INTERNAL_SERVER_ERROR
118+
})?;
113119
}
114120

115121
Ok(res)

0 commit comments

Comments
 (0)