Skip to content

Commit

Permalink
Backend: give failed servers info in exception
Browse files Browse the repository at this point in the history
Otherwise it's not clear enough to see the big picture when
it comes to server reliability.
  • Loading branch information
knocte committed Jul 4, 2024
1 parent 3af561c commit bb9a3ae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/GWallet.Backend/FaultTolerantParallelClient.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ type NotEnoughAvailableException =
numberOfConsistentResultsRequired)
}

type ResultInconsistencyException (totalNumberOfSuccesfulResultsObtained: uint32,
type ResultInconsistencyException (totalNumberOfFailedServers: uint32,
totalNumberOfSuccesfulResultsObtained: uint32,
maxNumberOfConsistentResultsObtained: int,
numberOfConsistentResultsRequired: uint32) =
inherit Exception ("Results obtained were not enough to be considered consistent" +
SPrintF3 " (received: %i, consistent: %i, required: %i)"
SPrintF4 " (unavailable: %i, received: %i, consistent: %i, required: %i)"
totalNumberOfFailedServers
totalNumberOfSuccesfulResultsObtained
maxNumberOfConsistentResultsObtained
numberOfConsistentResultsRequired)
Expand Down Expand Up @@ -629,7 +631,8 @@ type FaultTolerantParallelClient<'K,'E when 'K: equality and 'K :> ICommunicatio
| (_,maxNumberOfConsistentResultsObtained)::_ ->
if (retriesForInconsistency = settings.NumberOfRetriesForInconsistency) then
if totalNumberOfSuccesfulResultsObtained >= numberOfConsistentResponsesRequired then
return raise (ResultInconsistencyException(totalNumberOfSuccesfulResultsObtained,
return raise (ResultInconsistencyException(uint32 failedFuncs.Length,
totalNumberOfSuccesfulResultsObtained,
maxNumberOfConsistentResultsObtained,
numberOfConsistentResponsesRequired))
else
Expand Down

0 comments on commit bb9a3ae

Please sign in to comment.