forked from mirrors/relay
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 {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.debug_struct("Announce")
|
f.debug_struct("Announce")
|
||||||
.field("object_id", &self.object_id.to_string())
|
.field("object_id", &self.object_id.to_string())
|
||||||
.field("actor", &self.actor)
|
.field("actor_id", &self.actor.id)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,21 @@ use activitystreams::{
|
||||||
use background_jobs::ActixJob;
|
use background_jobs::ActixJob;
|
||||||
use std::{future::Future, pin::Pin};
|
use std::{future::Future, pin::Pin};
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||||
pub(crate) struct Follow {
|
pub(crate) struct Follow {
|
||||||
input: AcceptedActivities,
|
input: AcceptedActivities,
|
||||||
actor: Actor,
|
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 {
|
impl Follow {
|
||||||
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
||||||
Follow { input, actor }
|
Follow { input, actor }
|
||||||
|
|
|
@ -8,12 +8,21 @@ use activitystreams::prelude::*;
|
||||||
use background_jobs::ActixJob;
|
use background_jobs::ActixJob;
|
||||||
use std::{future::Future, pin::Pin};
|
use std::{future::Future, pin::Pin};
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||||
pub(crate) struct Forward {
|
pub(crate) struct Forward {
|
||||||
input: AcceptedActivities,
|
input: AcceptedActivities,
|
||||||
actor: Actor,
|
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 {
|
impl Forward {
|
||||||
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
pub fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
||||||
Forward { input, actor }
|
Forward { input, actor }
|
||||||
|
|
|
@ -7,9 +7,15 @@ use crate::{
|
||||||
use background_jobs::ActixJob;
|
use background_jobs::ActixJob;
|
||||||
use std::{future::Future, pin::Pin};
|
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);
|
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 {
|
impl Reject {
|
||||||
#[tracing::instrument(name = "Reject", skip(state))]
|
#[tracing::instrument(name = "Reject", skip(state))]
|
||||||
async fn perform(self, state: JobState) -> Result<(), Error> {
|
async fn perform(self, state: JobState) -> Result<(), Error> {
|
||||||
|
|
|
@ -5,15 +5,25 @@ use crate::{
|
||||||
error::Error,
|
error::Error,
|
||||||
jobs::{apub::generate_undo_follow, Deliver, JobState},
|
jobs::{apub::generate_undo_follow, Deliver, JobState},
|
||||||
};
|
};
|
||||||
|
use activitystreams::prelude::BaseExt;
|
||||||
use background_jobs::ActixJob;
|
use background_jobs::ActixJob;
|
||||||
use std::{future::Future, pin::Pin};
|
use std::{future::Future, pin::Pin};
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, serde::Deserialize, serde::Serialize)]
|
||||||
pub(crate) struct Undo {
|
pub(crate) struct Undo {
|
||||||
input: AcceptedActivities,
|
input: AcceptedActivities,
|
||||||
actor: Actor,
|
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 {
|
impl Undo {
|
||||||
pub(crate) fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
pub(crate) fn new(input: AcceptedActivities, actor: Actor) -> Self {
|
||||||
Undo { input, actor }
|
Undo { input, actor }
|
||||||
|
|
|
@ -13,7 +13,8 @@ impl std::fmt::Debug for Deliver {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.debug_struct("Deliver")
|
f.debug_struct("Deliver")
|
||||||
.field("to", &self.to.to_string())
|
.field("to", &self.to.to_string())
|
||||||
.field("data", &self.data)
|
.field("activity", &self.data["type"])
|
||||||
|
.field("object", &self.data["object"]["type"])
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ impl std::fmt::Debug for DeliverMany {
|
||||||
);
|
);
|
||||||
f.debug_struct("DeliverMany")
|
f.debug_struct("DeliverMany")
|
||||||
.field("to", &to)
|
.field("to", &to)
|
||||||
.field("data", &self.data)
|
.field("activity", &self.data["type"])
|
||||||
|
.field("object", &self.data["object"]["type"])
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ impl Requests {
|
||||||
#[tracing::instrument(
|
#[tracing::instrument(
|
||||||
"Deliver to Inbox",
|
"Deliver to Inbox",
|
||||||
skip_all,
|
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>
|
pub(crate) async fn deliver<T>(&self, inbox: IriString, item: &T) -> Result<(), Error>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue