hive-c0re re-converges wanted state whenever its watch attaches
pull waits (bounded) for the swarm queue connection instead of failing at boot while the client is still connecting. The watch runs one pull after every attach, including re-attaches, and a failed attach or ended stream is retried with a bounded backoff instead of waiting for the next boot. A first deploy is not queued again while one for the agent is queued or running. An agent whose first deploy was lost to a c0re restart is now deployed on the next boot, or the next watch re-attach, without anyone re-declaring it.
This commit is contained in:
parent
d989636d98
commit
784507f554
1 changed files with 395 additions and 70 deletions
|
|
@ -1537,3 +1537,29 @@ fn each_sweep_holds_its_own_resource() {
|
|||
vec![vec![Resource::KnowledgeTree]]
|
||||
);
|
||||
}
|
||||
|
||||
/// The pull, the watch and the deploy event can all see one declaration, so a
|
||||
/// second first deploy for an agent that has one queued must not be inserted.
|
||||
#[test]
|
||||
fn a_first_deploy_is_not_queued_twice_for_one_agent() {
|
||||
let q = JobQueue::new(1);
|
||||
let first = q.insert_first_deploy_once("newbie").expect("insert");
|
||||
assert!(first.is_some(), "control: the first deploy is queued");
|
||||
let kinds = || declared_shape(&q).len();
|
||||
let queued = kinds();
|
||||
|
||||
assert!(
|
||||
q.insert_first_deploy_once("newbie")
|
||||
.expect("insert")
|
||||
.is_none(),
|
||||
"a live first deploy for the same agent blocks another"
|
||||
);
|
||||
assert_eq!(kinds(), queued, "nothing was added");
|
||||
|
||||
assert!(
|
||||
q.insert_first_deploy_once("other")
|
||||
.expect("insert")
|
||||
.is_some(),
|
||||
"control: another agent's deploy is independent"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue