Skip to content

Commit

Permalink
bugfix:RReset failures for the roles have been removed
Browse files Browse the repository at this point in the history
  • Loading branch information
tailhook committed Apr 5, 2018
1 parent c0448eb commit 5562add
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ Verwalter Changes by Version
============================


.. _changelog-0.11.2:

Verwalter 0.11.2
----------------

* bugfix: reset failures for the roles have been removed


.. _changelog-0.11.1:

Verwalter 0.11.1
Expand Down
1 change: 1 addition & 0 deletions src/daemon/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ fn apply_schedule(hash: &String, is_new: bool,
.unwrap_or(&empty);
let string_schedule = format!("{}", scheduler_result);

state.reset_unused_roles(node_roles.keys());
for (role_name, ref node_role_vars) in node_roles.iter() {
let mut rlog = match dlog.role(&role_name, true) {
Ok(l) => l,
Expand Down
14 changes: 14 additions & 0 deletions src/daemon/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::sync::atomic::AtomicBool;
use std::time::{SystemTime};
use std::collections::{HashMap, BTreeMap, HashSet};
use std::collections::btree_map::Entry::{Occupied, Vacant};
use std::mem;

use futures::sync::oneshot;
use async_slot as slot;
Expand Down Expand Up @@ -393,6 +394,19 @@ impl SharedState {
role_errors.remove(role_name);
FAILING_ROLES.set(role_errors.len() as i64);
}
pub fn reset_unused_roles<T, I>(&self, roles: I)
where T: AsRef<str>, I: Iterator<Item=T>
{
let mut lock = self.lock();
let role_errors = Arc::make_mut(&mut lock.failed_roles);
let old_errors = mem::replace(role_errors, Default::default());
for name in roles {
if old_errors.contains(name.as_ref()) {
role_errors.insert(name.as_ref().into());
}
}
FAILING_ROLES.set(role_errors.len() as i64);
}
}

pub fn metrics() -> List {
Expand Down

0 comments on commit 5562add

Please sign in to comment.