Compare commits

...

3 commits

Author SHA1 Message Date
1cc1a616b9 fix(repo): avoid blocking threads when pausing
Some checks failed
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
Rust / build (push) Failing after 6m54s
2024-08-31 08:56:43 +01:00
eca556f976 feat(tui): use moving heart emoji as liveness indicator
All checks were successful
Rust / build (push) Successful in 7m17s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 52s
The heart moves between two positions every second as long as the ui is
being updated.
2024-08-31 08:56:43 +01:00
a3dd82705f fix(test): give actix more time to process message
All checks were successful
Rust / build (push) Successful in 7m13s
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 1m18s
2024-08-31 08:56:43 +01:00
4 changed files with 22 additions and 10 deletions

View file

@ -53,7 +53,7 @@ impl Handler<AdvanceNext> for RepoActor {
let sleep_duration = self.sleep_duration;
let log = self.log.clone();
async move {
std::thread::sleep(sleep_duration);
actix_rt::time::sleep(sleep_duration).await;
do_send(&addr, ValidateRepo::new(message_token), log.as_ref());
}
.in_current_span()

View file

@ -2,7 +2,7 @@
use actix::prelude::*;
use git_next_core::git::{forge::commit::Status, graph, UserNotification};
use tracing::{debug, Instrument as _};
use tracing::{debug, Instrument};
use crate::{
repo::{
@ -37,8 +37,14 @@ impl Handler<ReceiveCIStatus> for RepoActor {
do_send(&addr, AdvanceMain::new(next), self.log.as_ref());
}
Status::Pending => {
std::thread::sleep(sleep_duration);
do_send(&addr, ValidateRepo::new(message_token), self.log.as_ref());
let log = self.log.clone();
async move {
actix_rt::time::sleep(sleep_duration).await;
do_send(&addr, ValidateRepo::new(message_token), log.as_ref());
}
.in_current_span()
.into_actor(self)
.wait(ctx);
}
Status::Fail => {
tracing::warn!("Checks have failed");

View file

@ -81,7 +81,7 @@ async fn when_fail_should_recheck_after_delay() -> TestResult {
git::forge::commit::Status::Fail,
)))
.await?;
actix_rt::time::sleep(Duration::from_millis(1)).await;
actix_rt::time::sleep(Duration::from_millis(9)).await;
System::current().stop();
//then

View file

@ -40,6 +40,15 @@ impl State {
*tick += 1;
}
}
fn beating_heart(&self) -> String {
if self.last_update.duration_since(self.started).as_secs() % 2 == 0 {
"💚 "
} else {
" 💚"
}
.to_string()
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
@ -326,11 +335,8 @@ impl StatefulWidget for &State {
.title(
Title::from(Line::from(vec![
" [q]uit ".into(),
format!(
"{}s ",
self.last_update.duration_since(self.started).as_secs()
)
.into(),
self.beating_heart().into(),
" ".into(),
]))
.alignment(Alignment::Center)
.position(ratatui::widgets::block::Position::Bottom),