mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-25 11:01:11 +00:00
Simplify debug info for jobs
This commit is contained in:
parent
e37314355e
commit
3358ae0461
8 changed files with 44 additions and 8 deletions
|
@ -21,7 +21,7 @@ impl std::fmt::Debug for Announce {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Announce")
|
||||
.field("object_id", &self.object_id.to_string())
|
||||
.field("actor", &self.actor)
|
||||
.field("actor_id", &self.actor.id)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,12 +13,21 @@ use activitystreams::{
|
|||
use background_jobs::ActixJob;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||
pub(crate) struct Follow {
|
||||
input: AcceptedActivities,
|
||||
actor: Actor,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Follow {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Follow")
|
||||
.field("input", &self.input.id_unchecked())
|
||||
.field("actor", &self.actor.id)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Follow {
|
||||
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
||||
Follow { input, actor }
|
||||
|
|
|
@ -8,12 +8,21 @@ use activitystreams::prelude::*;
|
|||
use background_jobs::ActixJob;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||
pub(crate) struct Forward {
|
||||
input: AcceptedActivities,
|
||||
actor: Actor,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Forward {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Forward")
|
||||
.field("input", &self.input.id_unchecked())
|
||||
.field("actor", &self.actor.id)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Forward {
|
||||
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
||||
Forward { input, actor }
|
||||
|
|
|
@ -7,9 +7,15 @@ use crate::{
|
|||
use background_jobs::ActixJob;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||
pub(crate) struct Reject(pub(crate) Actor);
|
||||
|
||||
impl std::fmt::Debug for Reject {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Reject").field("actor", &self.0.id).finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Reject {
|
||||
#[tracing::instrument(name = "Reject", skip(state))]
|
||||
async fn perform(self, state: JobState) -> Result<(), Error> {
|
||||
|
|
|
@ -5,15 +5,25 @@ use crate::{
|
|||
error::Error,
|
||||
jobs::{apub::generate_undo_follow, Deliver, JobState},
|
||||
};
|
||||
use activitystreams::prelude::BaseExt;
|
||||
use background_jobs::ActixJob;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||
pub(crate) struct Undo {
|
||||
input: AcceptedActivities,
|
||||
actor: Actor,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Undo {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Undo")
|
||||
.field("input", &self.input.id_unchecked())
|
||||
.field("actor", &self.actor.id)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Undo {
|
||||
pub(crate) fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
||||
Undo { input, actor }
|
||||
|
|
|
@ -13,7 +13,8 @@ impl std::fmt::Debug for Deliver {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Deliver")
|
||||
.field("to", &self.to.to_string())
|
||||
.field("data", &self.data)
|
||||
.field("activity", &self.data["type"])
|
||||
.field("object", &self.data["object"]["type"])
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ impl std::fmt::Debug for DeliverMany {
|
|||
);
|
||||
f.debug_struct("DeliverMany")
|
||||
.field("to", &to)
|
||||
.field("data", &self.data)
|
||||
.field("activity", &self.data["type"])
|
||||
.field("object", &self.data["object"]["type"])
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ impl Requests {
|
|||
#[tracing::instrument(
|
||||
"Deliver to Inbox",
|
||||
skip_all,
|
||||
fields(inbox = inbox.to_string().as_str(), item)
|
||||
fields(inbox = inbox.to_string().as_str())
|
||||
)]
|
||||
pub(crate) async fn deliver<T>(&self, inbox: IriString, item: &T) -> Result<(), Error>
|
||||
where
|
||||
|
|
Loading…
Reference in a new issue