Skip to content
Clone
be93185
24 lines 694 B Rust
use std::error::Error;
use crate::sync::event::PostReceiveTask;
#[async_trait::async_trait]
pub trait WebhookTx: Send + Sync {
async fn dispatch(&self, task: &PostReceiveTask) -> Result<(), Box<dyn Error + Send + Sync>>;
}
#[derive(Debug, Default, Clone)]
pub struct NoopWebhookTx;
#[async_trait::async_trait]
impl WebhookTx for NoopWebhookTx {
async fn dispatch(&self, task: &PostReceiveTask) -> Result<(), Box<dyn Error + Send + Sync>> {
tracing::warn!(
task_id = %task.id,
repo_id = %task.repo_id,
refs = task.refs.len(),
"webhook dispatch not configured; message dropped (NoopWebhookTx)"
);
Ok(())
}
}