Improve comment / function name

This commit is contained in:
MATILLAT Quentin 2020-04-15 09:33:51 +01:00
parent 33d1d7cc9e
commit 77bf9b0318
No known key found for this signature in database
GPG key ID: D61BB405FF1285CC
3 changed files with 8 additions and 7 deletions

View file

@ -28,7 +28,7 @@ pub enum SubCommand {
delay_until: Option<DateTime<Local>>,
/// Start the task once all specified tasks have successfully finished.
/// If one of the dependencies failed, this task will be marked as failed
/// As soon as one of the dependencies fails, this task will be fail as well
#[structopt(name = "after", long)]
dependencies: Vec<usize>,
},

View file

@ -71,7 +71,7 @@ impl TaskHandler {
self.receive_commands();
self.process_finished();
self.check_stashed();
self.state.lock().unwrap().update_dependencies();
self.state.lock().unwrap().check_failed_dependencies();
if self.running && !self.reset {
let _res = self.check_new();
}

View file

@ -42,10 +42,11 @@ impl State {
self.max_id - 1
}
/// Search and return the next runnable task.
/// A runnable task:
/// - is in Queued state
/// - has all its dependencies in `Done` state
pub fn get_next_task_id(&mut self) -> Option<usize> {
// A runnable task:
// - is in Queued state
// - has all task in Done state
return self
.tasks
.iter()
@ -305,8 +306,8 @@ impl State {
Ok(())
}
/// Checkek that any Queued tasks dont have any failed dependencies, otherwise marked it as failed
pub fn update_dependencies(&mut self) {
/// Ensure that no `Queued` tasks dont have any failed dependencies, otherwise set their status to `Failed`.
pub fn check_failed_dependencies(&mut self) {
let has_failed_deps: Vec<_> = self
.tasks
.iter()