fix: don't reload config when updating next branch

The StartRepo handler loads the config before then sending the
ValidateRepo message. However, we already have the config, so reloading
it isn't needed.

Added todo markers on sleep and dispatching of ValidateRepo where it is
used as a stop-gap until we have working webhook integration.

Add todo markers for checking valid commit messages before advancing
next branch.
This commit is contained in:
Paul Campbell 2024-04-12 09:55:50 +01:00
parent 0b427f1d4c
commit 3735afb2f8
2 changed files with 9 additions and 3 deletions

View file

@ -6,12 +6,12 @@ use kxio::network;
use tracing::{error, info, warn};
use crate::server::{
actors::repo::branch,
actors::repo::{branch, ValidateRepo},
config::{self, BranchName},
forge,
};
use super::{RepoActor, StartMonitoring, StartRepo};
use super::{RepoActor, StartMonitoring};
#[tracing::instrument(fields(forge_name = %repo_details.forge.name, repo_name = %repo_details.name), skip_all)]
pub async fn validate_positions(
@ -52,6 +52,8 @@ pub async fn validate_positions(
)
.is_ok()
{
// TODO : (#18) sleep and restart while we don't have webhooks
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
addr.do_send(super::ValidateRepo)
}
return;
@ -121,6 +123,8 @@ pub async fn advance_next(
warn!("No commits to advance next to");
return;
};
// TODO: (#33) get commit message for 'commit'
// TODO: (#33) verify commit message is valid
match reset(
&repo_config.branches().next(),
commit,
@ -129,8 +133,9 @@ pub async fn advance_next(
) {
Ok(_) => {
info!("Success");
// TODO : (#18) sleep and restart while we don't have webhooks
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
addr.do_send(StartRepo);
addr.do_send(ValidateRepo);
}
Err(err) => {
warn!(?err, "Failed")

View file

@ -34,6 +34,7 @@ pub async fn check_next(
warn!("Checks have failed");
}
}
// TODO : (#18) sleep and restart while we don't have webhooks
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
addr.do_send(ValidateRepo);
}