Skip to content

Commit

Permalink
feat(dre): Show the date+time when voting, and do not stomp on previo…
Browse files Browse the repository at this point in the history
…us logs (#564)
  • Loading branch information
sasa-tomic authored Jul 3, 2024
1 parent c16e3c9 commit 5e0866f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "373e54054840c62d3438f63f1494707a66f3be25365a3abb2d53c837a692be7b",
"checksum": "eb89e30997310654d2570b9d1f5286d416c42b0f77df089644766f478c3fa6d8",
"crates": {
"actix-codec 0.5.2": {
"name": "actix-codec",
Expand Down Expand Up @@ -11164,6 +11164,10 @@
"id": "candid 0.10.9",
"target": "candid"
},
{
"id": "chrono 0.4.38",
"target": "chrono"
},
{
"id": "clap 4.5.7",
"target": "clap"
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rs/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ anyhow = { workspace = true }
async-recursion = { workspace = true }
async-trait = { workspace = true }
candid = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
clap-num = { workspace = true }
colored = { workspace = true }
Expand Down
7 changes: 6 additions & 1 deletion rs/cli/src/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ use std::{
};
use strum::IntoEnumIterator;

use chrono::Local;
use ic_canisters::{
governance::GovernanceCanisterWrapper, management::WalletCanisterWrapper, registry::RegistryCanisterWrapper, CanisterClient,
IcAgentCanisterClient,
Expand Down Expand Up @@ -82,6 +83,7 @@ pub async fn vote_on_proposals(
// in-memory set of proposals that we already voted on.
let mut voted_proposals = HashSet::new();

info!("Starting the voting loop...");
loop {
let proposals = client.get_pending_proposals().await?;
let proposals: Vec<&ProposalInfo> = proposals
Expand All @@ -97,8 +99,11 @@ pub async fn vote_on_proposals(
print!("\x1B[1A\x1B[K");
std::io::stdout().flush().unwrap();
for proposal in proposals_to_vote.into_iter() {
let datetime = Local::now();

info!(
"Voting on proposal {} (topic {:?}, proposer {}) -> {}",
"{} Voting on proposal {} (topic {:?}, proposer {}) -> {}",
datetime,
proposal.id.unwrap().id,
proposal.topic(),
proposal.proposer.unwrap_or_default().id,
Expand Down

0 comments on commit 5e0866f

Please sign in to comment.