aboutsummaryrefslogtreecommitdiff
path: root/src/k2v-client/bin/k2v-cli.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-04 14:00:02 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-04 14:00:02 +0200
commitb6d59ec19a3d41ce581716cf0dda5d47c2785843 (patch)
tree9f5147aeb868c62eb4d628258e4c2790a9cf4a6e /src/k2v-client/bin/k2v-cli.rs
parent0850bac874029f0b8b278d75537dd037e5db57da (diff)
downloadgarage-b6d59ec19a3d41ce581716cf0dda5d47c2785843.tar.gz
garage-b6d59ec19a3d41ce581716cf0dda5d47c2785843.zip
Fix poll item when item didn't changek2v-poll-fix
Diffstat (limited to 'src/k2v-client/bin/k2v-cli.rs')
-rw-r--r--src/k2v-client/bin/k2v-cli.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/k2v-client/bin/k2v-cli.rs b/src/k2v-client/bin/k2v-cli.rs
index 884e7438..925ebeb8 100644
--- a/src/k2v-client/bin/k2v-cli.rs
+++ b/src/k2v-client/bin/k2v-cli.rs
@@ -1,3 +1,5 @@
+use std::time::Duration;
+
use k2v_client::*;
use garage_util::formater::format_table;
@@ -64,6 +66,9 @@ enum Command {
/// Causality information
#[clap(short, long)]
causality: String,
+ /// Timeout, in seconds
+ #[clap(short, long)]
+ timeout: Option<u64>,
/// Output formating
#[clap(flatten)]
output_kind: ReadOutputKind,
@@ -341,10 +346,12 @@ async fn main() -> Result<(), Error> {
partition_key,
sort_key,
causality,
+ timeout,
output_kind,
} => {
+ let timeout = timeout.map(Duration::from_secs);
let res_opt = client
- .poll_item(&partition_key, &sort_key, causality.into(), None)
+ .poll_item(&partition_key, &sort_key, causality.into(), timeout)
.await?;
if let Some(res) = res_opt {
output_kind.display_output(res);