Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend.Console: show progress when checking balances #248

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading