Skip to content

Commit

Permalink
Add logs to credx wallet migration (#1004)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
  • Loading branch information
Patrik-Stas authored Oct 2, 2023
1 parent 7272cfb commit 725797b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions libvdrtools/indy-wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use indy_utils::{
crypto::chacha20poly1305_ietf::{self, Key as MasterKey},
secret,
};
use log::{debug, trace};
use log::{info, trace};
use serde::{Deserialize, Serialize};
use serde_json::Value as SValue;

Expand Down Expand Up @@ -714,6 +714,8 @@ impl WalletService {
let new_wallet = self.get_wallet(new_wh).await?;

let mut records = old_wallet.get_all().await?;
let total = records.get_total_count()?;
info!("Migrating {total:?} records");
let mut num_records = 0;

while let Some(WalletRecord {
Expand All @@ -724,6 +726,9 @@ impl WalletService {
}) = records.next().await?
{
num_records += 1;
if num_records % 1000 == 1 {
info!("Migrating wallet record number {num_records} / {total:?}");
}
let record = Record {
type_: type_.ok_or_else(|| {
err_msg(
Expand Down Expand Up @@ -755,7 +760,7 @@ impl WalletService {
}
}

debug!("{num_records} records have been migrated!");
info!("{num_records} / {total:?} records have been migrated!");

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion wallet_migrator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn migrate_wallet<E>(
where
E: Display,
{
info!("Starting wallet migration...");
info!("Starting wallet migration");

if src_wallet_handle == dest_wallet_handle {
error!("Equal wallet handles: {src_wallet_handle:?} {dest_wallet_handle:?}");
Expand Down

0 comments on commit 725797b

Please sign in to comment.