fix(repo): avoid blocking threads when pausing
This commit is contained in:
parent
8d9838ce2b
commit
5e38d4c280
2 changed files with 10 additions and 4 deletions
|
@ -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()
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue