Skip to content

Commit

Permalink
Frontend.Console: show progress on balance check
Browse files Browse the repository at this point in the history
Show progress when checking balances so that we can know which
currency is the slow one.

Fixes #245
  • Loading branch information
webwarrior-ws committed Jan 18, 2024
1 parent b05b90e commit 86ba3b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/GWallet.Frontend.Console/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,11 @@ let rec ProgramMainLoop() =
)

Console.WriteLine ()
Console.WriteLine "*** STATUS ***"
Console.WriteLine("*** STATUS ***" + Environment.NewLine)
let lines =
UserInteraction.DisplayAccountStatuses(WhichAccount.All activeAccounts)
|> Async.RunSynchronously
Console.WriteLine Environment.NewLine
Console.WriteLine (String.concat Environment.NewLine lines)
Console.WriteLine ()

Expand Down
4 changes: 4 additions & 0 deletions src/GWallet.Frontend.Console/UserInteraction.fs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ module UserInteraction =
// so that, in case balance retrieval is faster than FiatValEstimation, and the balance is zero, then
// we don't need to query the fiat value at all (micro-optimization?)
let! balance,usdValue = FSharpUtil.AsyncExtensions.MixedParallel2 balanceJob usdValueJob

Console.Write account.Currency
Console.Write ' '

return (account,balance,usdValue)
}
Expand All @@ -264,6 +267,7 @@ module UserInteraction =
let private GetAccountBalances (accounts: seq<IAccount>)
: Async<array<IAccount*MaybeCached<decimal>*MaybeCached<decimal>>> =
let accountAndBalancesToBeQueried = accounts |> Seq.map GetAccountBalanceInner
Console.Write "Retrieving balances... "
Async.Parallel accountAndBalancesToBeQueried

let DisplayAccountStatuses(whichAccount: WhichAccount): Async<seq<string>> =
Expand Down

0 comments on commit 86ba3b5

Please sign in to comment.