Compare commits
3 commits
154141a6ed
...
1cc1a616b9
Author | SHA1 | Date | |
---|---|---|---|
1cc1a616b9 | |||
eca556f976 | |||
a3dd82705f |
4 changed files with 22 additions and 10 deletions
|
@ -53,7 +53,7 @@ impl Handler<AdvanceNext> for RepoActor {
|
||||||
let sleep_duration = self.sleep_duration;
|
let sleep_duration = self.sleep_duration;
|
||||||
let log = self.log.clone();
|
let log = self.log.clone();
|
||||||
async move {
|
async move {
|
||||||
std::thread::sleep(sleep_duration);
|
actix_rt::time::sleep(sleep_duration).await;
|
||||||
do_send(&addr, ValidateRepo::new(message_token), log.as_ref());
|
do_send(&addr, ValidateRepo::new(message_token), log.as_ref());
|
||||||
}
|
}
|
||||||
.in_current_span()
|
.in_current_span()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
|
||||||
use git_next_core::git::{forge::commit::Status, graph, UserNotification};
|
use git_next_core::git::{forge::commit::Status, graph, UserNotification};
|
||||||
use tracing::{debug, Instrument as _};
|
use tracing::{debug, Instrument};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
repo::{
|
repo::{
|
||||||
|
@ -37,8 +37,14 @@ impl Handler<ReceiveCIStatus> for RepoActor {
|
||||||
do_send(&addr, AdvanceMain::new(next), self.log.as_ref());
|
do_send(&addr, AdvanceMain::new(next), self.log.as_ref());
|
||||||
}
|
}
|
||||||
Status::Pending => {
|
Status::Pending => {
|
||||||
std::thread::sleep(sleep_duration);
|
let log = self.log.clone();
|
||||||
do_send(&addr, ValidateRepo::new(message_token), self.log.as_ref());
|
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 => {
|
Status::Fail => {
|
||||||
tracing::warn!("Checks have failed");
|
tracing::warn!("Checks have failed");
|
||||||
|
|
|
@ -81,7 +81,7 @@ async fn when_fail_should_recheck_after_delay() -> TestResult {
|
||||||
git::forge::commit::Status::Fail,
|
git::forge::commit::Status::Fail,
|
||||||
)))
|
)))
|
||||||
.await?;
|
.await?;
|
||||||
actix_rt::time::sleep(Duration::from_millis(1)).await;
|
actix_rt::time::sleep(Duration::from_millis(9)).await;
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
|
|
|
@ -40,6 +40,15 @@ impl State {
|
||||||
*tick += 1;
|
*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)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
|
@ -326,11 +335,8 @@ impl StatefulWidget for &State {
|
||||||
.title(
|
.title(
|
||||||
Title::from(Line::from(vec![
|
Title::from(Line::from(vec![
|
||||||
" [q]uit ".into(),
|
" [q]uit ".into(),
|
||||||
format!(
|
self.beating_heart().into(),
|
||||||
"{}s ",
|
" ".into(),
|
||||||
self.last_update.duration_since(self.started).as_secs()
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
]))
|
]))
|
||||||
.alignment(Alignment::Center)
|
.alignment(Alignment::Center)
|
||||||
.position(ratatui::widgets::block::Position::Bottom),
|
.position(ratatui::widgets::block::Position::Bottom),
|
||||||
|
|
Loading…
Reference in a new issue