From f398fb3b6a122a135f308fd54244f67c37d62670 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 18 May 2024 22:33:58 +0100 Subject: [PATCH] feat(server/webhook): warn when message is dropped --- crates/server/src/actors/repo/webhook.rs | 6 +++--- crates/server/src/gitforge/forgejo/mod.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/server/src/actors/repo/webhook.rs b/crates/server/src/actors/repo/webhook.rs index 28affc6..f778b5a 100644 --- a/crates/server/src/actors/repo/webhook.rs +++ b/crates/server/src/actors/repo/webhook.rs @@ -2,7 +2,7 @@ use actix::prelude::*; use git_next_config::{BranchName, RepoBranches}; use git_next_git::{self as git, RepoDetails}; use kxio::network::{self, json}; -use tracing::{debug, info, warn}; +use tracing::{info, warn}; use ulid::DecodeError; use std::{collections::HashMap, str::FromStr}; @@ -183,15 +183,15 @@ impl Handler for RepoActor { #[tracing::instrument(name = "RepoActor::WebhookMessage", skip_all, fields(token = %self.message_token, repo = %self.details))] fn handle(&mut self, msg: WebhookMessage, ctx: &mut Self::Context) -> Self::Result { if msg.authorisation() != self.webhook_auth { + warn!("Invalid authorization"); return; // invalid auth } let id = msg.id(); let span = tracing::info_span!("handle", %id); let _guard = span.enter(); let body = msg.body(); - debug!(%id, "RepoActor received message"); match serde_json::from_str::(body) { - Err(err) => debug!(?err, %body, "Not a 'push'"), + Err(err) => warn!(?err, %body, "Not a 'push'"), Ok(push) => { if let Some(config) = &self.details.repo_config { match push.branch(config.branches()) { diff --git a/crates/server/src/gitforge/forgejo/mod.rs b/crates/server/src/gitforge/forgejo/mod.rs index 4046abd..21b0ca4 100644 --- a/crates/server/src/gitforge/forgejo/mod.rs +++ b/crates/server/src/gitforge/forgejo/mod.rs @@ -68,7 +68,7 @@ impl super::ForgeLike for ForgeJoEnv { addr.do_send(StartMonitoring::new(main, next, dev, dev_commit_history)); } Err(err) => { - warn!("{}", err); + warn!("{:?}", err); tokio::time::sleep(Duration::from_secs(10)).await; addr.do_send(ValidateRepo::new(message_token)); }