chore: instrument inbox/outbox
this is where side effects happen, so better keep them under control also trying out tracing, i should redo how i trace stuff in upub...
This commit is contained in:
parent
5b592874cb
commit
876cf19327
3 changed files with 5 additions and 2 deletions
|
@ -10,6 +10,7 @@ use super::{fetcher::Fetcher, httpsign::HttpSignature};
|
||||||
pub enum Identity {
|
pub enum Identity {
|
||||||
Anonymous,
|
Anonymous,
|
||||||
Remote {
|
Remote {
|
||||||
|
user: String,
|
||||||
domain: String,
|
domain: String,
|
||||||
internal: i64,
|
internal: i64,
|
||||||
},
|
},
|
||||||
|
@ -124,11 +125,11 @@ where
|
||||||
.verify(&user.public_key)
|
.verify(&user.public_key)
|
||||||
{
|
{
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
// TODO can we avoid this extra db rountrip made on each server fetch?
|
let user = user.id;
|
||||||
let domain = Context::server(&user_id);
|
let domain = Context::server(&user_id);
|
||||||
// TODO this will fail because we never fetch and insert into instance oops
|
// TODO this will fail because we never fetch and insert into instance oops
|
||||||
let internal = model::instance::Entity::domain_to_internal(&domain, ctx.db()).await?;
|
let internal = model::instance::Entity::domain_to_internal(&domain, ctx.db()).await?;
|
||||||
identity = Identity::Remote { domain, internal };
|
identity = Identity::Remote { user, domain, internal };
|
||||||
},
|
},
|
||||||
Ok(false) => tracing::warn!("invalid signature: {http_signature:?}"),
|
Ok(false) => tracing::warn!("invalid signature: {http_signature:?}"),
|
||||||
Err(e) => tracing::error!("error verifying signature: {e}"),
|
Err(e) => tracing::error!("error verifying signature: {e}"),
|
||||||
|
|
|
@ -38,6 +38,7 @@ macro_rules! pretty_json {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[tracing::instrument(level = "info", skip(ctx), fields(activity = %activity))]
|
||||||
pub async fn post(
|
pub async fn post(
|
||||||
State(ctx): State<Context>,
|
State(ctx): State<Context>,
|
||||||
AuthIdentity(auth): AuthIdentity,
|
AuthIdentity(auth): AuthIdentity,
|
||||||
|
|
|
@ -37,6 +37,7 @@ pub async fn page(
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = "info", skip(ctx), fields(activity = %activity))]
|
||||||
pub async fn post(
|
pub async fn post(
|
||||||
State(ctx): State<Context>,
|
State(ctx): State<Context>,
|
||||||
Path(id): Path<String>,
|
Path(id): Path<String>,
|
||||||
|
|
Loading…
Reference in a new issue