Skip to content

Commit

Permalink
updated indicatif_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
FroVolod committed Apr 9, 2024
1 parent 2b66e2f commit fd311f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
24 changes: 11 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,17 @@ fn main() -> crate::common::CliResult {

let indicatif_layer = IndicatifLayer::new()
.with_progress_style(
ProgressStyle::with_template(
"{spinner:.blue}{span_child_prefix} {span_name} {{{span_fields}}}",
)
.unwrap()
.tick_strings(&[
"▹▹▹▹▹",
"▸▹▹▹▹",
"▹▸▹▹▹",
"▹▹▸▹▹",
"▹▹▹▸▹",
"▹▹▹▹▸",
"▪▪▪▪▪",
]),
ProgressStyle::with_template("{spinner:.blue}{span_child_prefix} {msg}{span_name}")
.unwrap()
.tick_strings(&[
"▹▹▹▹▹",
"▸▹▹▹▹",
"▹▸▹▹▹",
"▹▹▸▹▹",
"▹▹▹▸▹",
"▹▹▹▹▸",
"▪▪▪▪▪",
]),
)
.with_span_child_prefix_symbol("↳ ");
tracing_subscriber::registry()
Expand Down
10 changes: 7 additions & 3 deletions src/transaction_signature_options/send/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use tracing_indicatif::span_ext::IndicatifSpanExt;

#[derive(Debug, Clone, interactive_clap_derive::InteractiveClap)]
#[interactive_clap(input_context = super::SubmitContext)]
#[interactive_clap(output_context = SendContext)]
Expand All @@ -12,7 +14,6 @@ impl SendContext {
previous_context: super::SubmitContext,
_scope: &<Send as interactive_clap::ToInteractiveClapContextScope>::InteractiveClapContextScope,
) -> color_eyre::eyre::Result<Self> {
std::thread::sleep(std::time::Duration::from_millis(100));
let mut storage_message = String::new();

match previous_context.signed_transaction_or_signed_delegate_action {
Expand All @@ -29,6 +30,7 @@ impl SendContext {
let retries_number = 5;
let mut retries = (0..retries_number).rev();
let transaction_info = loop {
std::thread::sleep(std::time::Duration::from_millis(300));
let transaction_info_result =
tokio::runtime::Runtime::new()
.unwrap()
Expand Down Expand Up @@ -118,12 +120,13 @@ impl SendContext {
}
}

#[tracing::instrument(name="", fields(%message))]
#[tracing::instrument(skip_all, name = "")]
fn err_message(message: String) {
tracing::Span::current().pb_set_message(&message);
std::thread::sleep(std::time::Duration::from_secs(5));
}

#[tracing::instrument(name="", skip_all, fields(%message))]
#[tracing::instrument(skip_all, name = "")]
async fn sending_transaction(
message: String,
json_rpc_client: &near_jsonrpc_client::JsonRpcClient,
Expand All @@ -134,6 +137,7 @@ async fn sending_transaction(
near_jsonrpc_primitives::types::transactions::RpcTransactionError,
>,
> {
tracing::Span::current().pb_set_message(&message);
std::thread::sleep(std::time::Duration::from_secs(1));
json_rpc_client
.call(
Expand Down

0 comments on commit fd311f7

Please sign in to comment.