Skip to content

Commit 725797b

Browse files
authored
Add logs to credx wallet migration (#1004)
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
1 parent 7272cfb commit 725797b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

libvdrtools/indy-wallet/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use indy_utils::{
1818
crypto::chacha20poly1305_ietf::{self, Key as MasterKey},
1919
secret,
2020
};
21-
use log::{debug, trace};
21+
use log::{info, trace};
2222
use serde::{Deserialize, Serialize};
2323
use serde_json::Value as SValue;
2424

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

716716
let mut records = old_wallet.get_all().await?;
717+
let total = records.get_total_count()?;
718+
info!("Migrating {total:?} records");
717719
let mut num_records = 0;
718720

719721
while let Some(WalletRecord {
@@ -724,6 +726,9 @@ impl WalletService {
724726
}) = records.next().await?
725727
{
726728
num_records += 1;
729+
if num_records % 1000 == 1 {
730+
info!("Migrating wallet record number {num_records} / {total:?}");
731+
}
727732
let record = Record {
728733
type_: type_.ok_or_else(|| {
729734
err_msg(
@@ -755,7 +760,7 @@ impl WalletService {
755760
}
756761
}
757762

758-
debug!("{num_records} records have been migrated!");
763+
info!("{num_records} / {total:?} records have been migrated!");
759764

760765
Ok(())
761766
}

wallet_migrator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub async fn migrate_wallet<E>(
2222
where
2323
E: Display,
2424
{
25-
info!("Starting wallet migration...");
25+
info!("Starting wallet migration");
2626

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

0 commit comments

Comments
 (0)