Skip to content

Commit

Permalink
retry: Explain why we need a second client for now
Browse files Browse the repository at this point in the history
This is a limitation in our `Client` type and in how we handle `retry`.
We should fix `retry` to be truly idempotent on the server (by having
the client send a UUID with each request that we can use to detect
duplicate requests), and then wrap the client in a retry block.
  • Loading branch information
emk committed Jun 17, 2019
1 parent df92433 commit cc99f09
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions falconeri/src/cmd/job/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ use falconeri_common::{prelude::*, rest_api::Client};

/// The `job retry` subcommand.
pub fn run(job_name: &str) -> Result<()> {
let client = Client::new(ConnectVia::Proxy)?;
let mut client = Client::new(ConnectVia::Proxy)?;
let job = client.find_job_by_name(job_name)?;
let client2 = Client::new(ConnectVia::Proxy)?;
let new_job = client2.retry_job(&job)?;
// TODO: We need to create a new client here because we don't have HTTP
// keepalive set up, and we don't have a good way to run `retry_job`
// idempotently yet.
client = Client::new(ConnectVia::Proxy)?;
let new_job = client.retry_job(&job)?;
println!("{}", new_job.job_name);
Ok(())
}

0 comments on commit cc99f09

Please sign in to comment.