feat(server/webhook): warn when message is dropped
All checks were successful
Rust / build (push) Successful in 2m7s
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful

This commit is contained in:
Paul Campbell 2024-05-18 22:33:58 +01:00
parent 9d0f2d1ba1
commit f398fb3b6a
2 changed files with 4 additions and 4 deletions

View file

@ -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<WebhookMessage> 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::<Push>(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()) {

View file

@ -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));
}