refactor: Update TUI sooner when receiving CI status
All checks were successful
Rust / build (push) Successful in 6m6s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m49s

Looking to avoid getting stuck on 'Checking CI status', but this doesn't
appear to be where the problem is coming from.
This commit is contained in:
Paul Campbell 2024-09-14 07:28:39 +01:00
parent 93cf6f83df
commit 8359d0d7ca
2 changed files with 11 additions and 12 deletions

View file

@ -17,21 +17,20 @@ impl Handler<ReceiveCIStatus> for RepoActor {
type Result = (); type Result = ();
fn handle(&mut self, msg: ReceiveCIStatus, ctx: &mut Self::Context) -> Self::Result { fn handle(&mut self, msg: ReceiveCIStatus, ctx: &mut Self::Context) -> Self::Result {
let log = self.log.clone(); logger(self.log.as_ref(), "start: ReceiveCIStatus");
logger(log.as_ref(), "start: ReceiveCIStatus");
let addr = ctx.address();
let (next, status) = msg.peel(); let (next, status) = msg.peel();
self.update_tui(RepoUpdate::ReceiveCIStatus {
status: status.clone(),
});
debug!(?status, "");
let graph_log = graph::log(&self.repo_details);
self.update_tui_log(graph_log.clone());
let addr = ctx.address();
let forge_alias = self.repo_details.forge.forge_alias().clone(); let forge_alias = self.repo_details.forge.forge_alias().clone();
let repo_alias = self.repo_details.repo_alias.clone(); let repo_alias = self.repo_details.repo_alias.clone();
let message_token = self.message_token; let message_token = self.message_token;
let sleep_duration = self.sleep_duration; let sleep_duration = self.sleep_duration;
let graph_log = graph::log(&self.repo_details);
self.update_tui_log(graph_log.clone());
self.update_tui(RepoUpdate::ReceiveCIStatus {
status: status.clone(),
});
debug!(?status, "");
match status { match status {
Status::Pass => { Status::Pass => {
do_send(&addr, AdvanceMain::new(next), self.log.as_ref()); do_send(&addr, AdvanceMain::new(next), self.log.as_ref());
@ -57,8 +56,9 @@ impl Handler<ReceiveCIStatus> for RepoActor {
commit: next, commit: next,
log: graph_log, log: graph_log,
}, },
log.as_ref(), self.log.as_ref(),
); );
let log = self.log.clone();
async move { async move {
debug!("sleeping before retrying..."); debug!("sleeping before retrying...");
logger(log.as_ref(), "before sleep"); logger(log.as_ref(), "before sleep");

View file

@ -79,7 +79,6 @@ impl Handler<ValidateRepo> for RepoActor {
self.update_tui_log(git_log); self.update_tui_log(git_log);
if next_is_valid && next != main { if next_is_valid && next != main {
info!("Checking CI"); info!("Checking CI");
self.update_tui(RepoUpdate::CheckingCI);
do_send(&ctx.address(), CheckCIStatus::new(next), self.log.as_ref()); do_send(&ctx.address(), CheckCIStatus::new(next), self.log.as_ref());
} else if next != dev { } else if next != dev {
info!("Advance next"); info!("Advance next");