Skip to content

Commit

Permalink
Merge branch 'release/2.11.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Algo-devops-service committed May 3, 2022
2 parents 103b897 + 814aca1 commit bbc1d3e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.10.0
2.11.0
2 changes: 1 addition & 1 deletion api/error_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
errFailedSearchingApplication = "failed while searching for application"
errFailedLookingUpHealth = "failed while getting indexer health"
errNoApplicationsFound = "no application found for application-id"
errNoAccountsFound = "no accounts found for address"
ErrNoAccountsFound = "no accounts found for address"
errNoAssetsFound = "no assets found for asset-id"
errNoTransactionFound = "no transaction found for transaction id"
errMultipleTransactions = "multiple transactions found for this txid, please contact us, this shouldn't happen"
Expand Down
2 changes: 1 addition & 1 deletion api/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (si *ServerImplementation) LookupAccountByID(ctx echo.Context, accountID st
}

if len(accounts) == 0 {
return notFound(ctx, fmt.Sprintf("%s: %s", errNoAccountsFound, accountID))
return notFound(ctx, fmt.Sprintf("%s: %s", ErrNoAccountsFound, accountID))
}

if len(accounts) > 1 {
Expand Down
3 changes: 3 additions & 0 deletions cmd/validator/core/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func resultsPrinter(config Params, printCurl bool, results <-chan Result) int {
duration := endTime.Sub(startTime)
fmt.Printf("\n\nNumber of errors: [%d / %d]\n", numErrors, numResults)
fmt.Printf("Skipped (%s): %d\n", SkipLimitReached, skipCounts[SkipLimitReached])
fmt.Printf("Skipped (%s): %d\n", SkipAccountNotFound, skipCounts[SkipAccountNotFound])
fmt.Printf("Retry count: %d\n", numRetries)
fmt.Printf("Checks per second: %f\n", float64(numResults+numRetries)/duration.Seconds())
fmt.Printf("Test duration: %s\n", time.Time{}.Add(duration).Format("15:04:05"))
Expand Down Expand Up @@ -189,6 +190,8 @@ func resultsPrinter(config Params, printCurl bool, results <-chan Result) int {
switch r.SkipReason {
case SkipLimitReached:
ErrorLog.Printf("Address skipped: too many asset and/or accounts to return\n")
case SkipAccountNotFound:
ErrorLog.Printf("Address skipped: account not found, probably deleted\n")
default:
ErrorLog.Printf("Address skipped: Unknown reason (%s)\n", r.SkipReason)
}
Expand Down
12 changes: 8 additions & 4 deletions cmd/validator/core/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ type Processor interface {
// Skip indicates why something was skipped.
type Skip string

// constants relating to different skip cases
const (
// NotSkipped is the default value indicated the results are not skipped.
NotSkipped Skip = ""
// SkipLimitReached is used when the result is skipped because an account
// resource limit prevents fetching results.
SkipLimitReached Skip = "account-limit"
NotSkipped Skip = ""
SkipLimitReached Skip = "account-limit"
SkipAccountNotFound Skip = "missing-account"
)

// Result is the output of ProcessAddress.
Expand Down Expand Up @@ -133,6 +133,7 @@ func CallProcessor(processor Processor, addrInput string, config Params, results
// catches up with the first algod account query.
algodData, err := getData(algodDataURL, config.AlgodToken)
if err != nil {
err = fmt.Errorf("error getting algod data (%d): %w", algodData, err)
results <- resultError(err, addrInput)
return
}
Expand All @@ -141,9 +142,12 @@ func CallProcessor(processor Processor, addrInput string, config Params, results
for i := 0; true; i++ {
indexerData, err := getData(indexerDataURL, config.IndexerToken)
if err != nil {
err = fmt.Errorf("error getting indexer data (%d): %w", indexerData, err)
switch {
case strings.Contains(string(indexerData), api.ErrResultLimitReached):
results <- resultSkip(err, addrInput, SkipLimitReached)
case strings.Contains(string(indexerData), api.ErrNoAccountsFound):
results <- resultSkip(err, addrInput, SkipAccountNotFound)
default:
results <- resultError(err, addrInput)
}
Expand Down
4 changes: 2 additions & 2 deletions misc/generate_accounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function help () {
}

#default selection queries
SELECTION_QUERY="select encode(addr,'base64') from account where deleted is not null limit 1000"
SELECTION_QUERY_COPY="COPY (select encode(addr, 'base64') from account) TO stdout"
SELECTION_QUERY="select encode(addr,'base64') from account where deleted is false limit 1000"
SELECTION_QUERY_COPY="COPY (select encode(addr, 'base64') from account where deleted is false) TO stdout"

START_TIME=$SECONDS
PGUSER=
Expand Down

0 comments on commit bbc1d3e

Please sign in to comment.