Skip to content

Commit

Permalink
Timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
gr211 committed Oct 20, 2023
1 parent a01b7a2 commit 2a7cdbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cli_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub struct Opt {
#[structopt(short, long)]
pub verbose: bool,

/// Exits of no messages received after <timeout> seconds.
/// Exits if no messages received after <timeout> seconds.
#[structopt(long)]
pub timeout: Option<u16>,
}
Expand Down
5 changes: 4 additions & 1 deletion src/kinesis/ticker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ impl Ticker {
let duration = Utc::now() - last_ts;

if duration.num_milliseconds() > (timeout * 1000) as i64 {
tx_records.send(Err(Timeout(duration))).await.unwrap();
tx_records
.send(Err(Timeout(duration)))
.await
.expect("Could not sent Timeout to tx_records");
}

sleep(delay).await
Expand Down

0 comments on commit 2a7cdbe

Please sign in to comment.