fix: delivery passes error up
This commit is contained in:
parent
11b4ae8678
commit
b086fe969f
2 changed files with 5 additions and 11 deletions
|
@ -1,4 +1,3 @@
|
|||
use sea_orm::EntityTrait;
|
||||
use reqwest::Method;
|
||||
|
||||
use apb::{LD, ActivityMut};
|
||||
|
@ -59,16 +58,11 @@ pub async fn process(ctx: Context, job: &model::job::Model) -> crate::JobResult<
|
|||
return Ok(());
|
||||
};
|
||||
|
||||
if let Err(e) = Context::request(
|
||||
Context::request(
|
||||
Method::POST, job.target.as_deref().unwrap_or(""),
|
||||
Some(&serde_json::to_string(&payload.ld_context()).unwrap()),
|
||||
&job.actor, &key, ctx.domain()
|
||||
).await {
|
||||
tracing::warn!("failed delivery of {} to {:?} : {e}", job.activity, job.target);
|
||||
model::job::Entity::insert(job.clone().repeat(Some(e.to_string())))
|
||||
.exec(ctx.db())
|
||||
.await?;
|
||||
}
|
||||
).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@ pub enum JobError {
|
|||
#[error("malformed job: missing payload")]
|
||||
MissingPayload,
|
||||
|
||||
#[error("no available implementation to process job")]
|
||||
Unprocessable,
|
||||
|
||||
#[error("error processing activity: {0:?}")]
|
||||
ProcessorError(#[from] upub::traits::process::ProcessorError),
|
||||
|
||||
#[error("error delivering activity: {0}")]
|
||||
DeliveryError(#[from] upub::traits::fetch::RequestError),
|
||||
}
|
||||
|
||||
pub type JobResult<T> = Result<T, JobError>;
|
||||
|
|
Loading…
Reference in a new issue