Skip to content

Commit

Permalink
Add rand archive url
Browse files Browse the repository at this point in the history
  • Loading branch information
chowbao committed Jan 16, 2024
1 parent 3aa64b9 commit d7f4881
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/utils/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"math/big"
"math/rand"
"time"

"github.com/spf13/pflag"
Expand Down Expand Up @@ -538,7 +539,15 @@ var futureArchiveURLs = []string{
}

func CreateHistoryArchiveClient(archiveURLS []string) (historyarchive.ArchiveInterface, error) {
return historyarchive.NewArchivePool(archiveURLS, historyarchive.ConnectOptions{UserAgent: "stellar-etl/1.0.0"})
var archiveInterface historyarchive.ArchiveInterface

archivePool, err := historyarchive.NewArchivePool(archiveURLS, historyarchive.ConnectOptions{UserAgent: "stellar-etl/1.0.0"})
if err != nil {
return archiveInterface, err
}

// Use random archive pool
return archivePool[int32(rand.Intn(len(archivePool)))], nil
}

// GetLatestLedgerSequence returns the latest ledger sequence
Expand Down

0 comments on commit d7f4881

Please sign in to comment.