Skip to content

Commit

Permalink
postrebase fix + better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
archeoss committed Jan 21, 2024
1 parent 45824fa commit adcff00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions backend/src/services/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use super::prelude::*;
),
security(("api_key" = []))
))]
#[tracing::instrument(ret, skip(client), level = "info", fields(method = "GET"))]
pub async fn get_disks_count(Extension(client): Extension<HttpBobClient>) -> Json<DiskCount> {
tracing::info!("get /disks/count : {:?}", client);

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

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

Expand Down Expand Up @@ -168,6 +171,7 @@ pub async fn get_rps(Extension(client): Extension<HttpBobClient>) -> Json<RPS> {
),
security(("api_key" = []))
))]
#[tracing::instrument(ret, skip(client), level = "info", fields(method = "GET"))]
pub async fn get_space(Extension(client): Extension<HttpBobClient>) -> Json<SpaceInfo> {
tracing::info!("get /space : {:?}", client);
let mut spaces: FuturesUnordered<_> = client
Expand Down
10 changes: 8 additions & 2 deletions backend/src/services/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub async fn login(
Extension(request_timeout): Extension<RequestTimeout>,
Json(bob): Json<BobConnectionData>,
) -> AxumResult<StatusCode> {
let bob_client = BobClient::<HttpClient>::try_new(bob.clone(), request_timeout)
let bob_client = BobClient::<_, HttpClient>::try_new(bob.clone(), request_timeout)
.await
.map_err(|err| {
tracing::error!("{err:?}");
Expand Down Expand Up @@ -109,7 +109,13 @@ pub async fn login(
tracing::error!("{err:?}");
StatusCode::UNAUTHORIZED
})?;
auth.client_store.insert(*bob_client.id(), bob_client);
auth.client_store
.save(*bob_client.id(), bob_client)
.await
.map_err(|err| {
tracing::error!("{err:?}");
StatusCode::INTERNAL_SERVER_ERROR
})?;
}

Ok(res)
Expand Down

0 comments on commit adcff00

Please sign in to comment.