Skip to content

Commit

Permalink
fix: use milis in events streaming
Browse files Browse the repository at this point in the history
Signed-off-by: Lohachov Mykhailo <[email protected]>
  • Loading branch information
aoyako committed Nov 19, 2024
1 parent ac02c69 commit 8fd4f1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions crates/iroha_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ mod events {

#[derive(clap::Args, Debug, Clone, Copy)]
pub struct Args {
/// Wait timeout in seconds
#[clap(short, long, global = true)]
timeout: Option<u64>,
timeout: Option<f32>,
#[clap(subcommand)]
command: Command,
}
Expand All @@ -331,7 +332,11 @@ mod events {

impl RunArgs for Args {
fn run(self, context: &mut dyn RunContext) -> Result<()> {
let timeout = self.timeout.map(Duration::from_secs);
let timeout = self
.timeout
.map(|t| (1000f32 * t).floor() as u64)
.map(Duration::from_millis);

match self.command {
Command::TransactionPipeline => {
listen(TransactionEventFilter::default(), context, timeout)
Expand All @@ -348,7 +353,7 @@ mod events {
}
}

pub fn listen(
fn listen(
filter: impl Into<EventFilterBox>,
context: &mut dyn RunContext,
timeout: Option<Duration>,
Expand Down Expand Up @@ -400,17 +405,14 @@ mod blocks {
impl RunArgs for Args {
fn run(self, context: &mut dyn RunContext) -> Result<()> {
let Args { height, timeout } = self;
listen(
height,
context,
timeout
.map(|t| (1000f32 * t).floor() as u64)
.map(Duration::from_millis),
)
let timeout = timeout
.map(|t| (1000f32 * t).floor() as u64)
.map(Duration::from_millis);
listen(height, context, timeout)
}
}

pub fn listen(
fn listen(
height: NonZeroU64,
context: &mut dyn RunContext,
timeout: Option<Duration>,
Expand Down
2 changes: 1 addition & 1 deletion defaults/docker-compose.single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
retries: 30
start_period: 4s
command: |-
/bin/bash -c "
/bin/sh -c "
EXECUTOR_RELATIVE_PATH=$(jq -r '.executor' /config/genesis.json) && \\
EXECUTOR_ABSOLUTE_PATH=$(realpath \"/config/$$EXECUTOR_RELATIVE_PATH\") && \\
WASM_DIR_RELATIVE_PATH=$(jq -r '.wasm_dir' /config/genesis.json) && \\
Expand Down

0 comments on commit 8fd4f1f

Please sign in to comment.