Skip to content

Commit

Permalink
Reset informer to update version if error (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger authored Nov 21, 2019
1 parent b9e0ed1 commit bd2e378
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gordo-controller"
version = "0.2.0"
version = "0.2.1"
authors = ["Miles Granger <[email protected]>"]
edition = "2018"

Expand Down
13 changes: 12 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ async fn main() -> ! {
// or otherwise hasn't been submitted at all.
launch_waiting_gordo_workflows(&resource, &client, &namespace, &env_config).await;

let mut outdated_version = false;

loop {
// Update state changes
informer
Expand Down Expand Up @@ -126,9 +128,18 @@ async fn main() -> ! {
// Remove any old jobs associated with this Gordo which has been deleted.
remove_gordo_deploy_jobs(&gordo, &client, &namespace).await;
}
WatchEvent::Error(e) => info!("Gordo resource error from k8s: {:?}", e),
WatchEvent::Error(e) => {
error!("Gordo resource error from k8s: {:?}", e);
outdated_version = true;
}
}
}

// Update the informer version after emptying the queue if watch event error encountered.
if outdated_version {
informer.reset().await.unwrap();
outdated_version = false;
}
}
}

Expand Down

0 comments on commit bd2e378

Please sign in to comment.