Skip to content

Commit

Permalink
(NOBIDS) fix batching of ens reads
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbitfly committed Dec 19, 2023
1 parent e2e77bd commit 1e301d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/eth1indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func main() {
}

if *enableEnsUpdater {
err := bt.ImportEnsUpdates(client.GetNativeClient())
err := bt.ImportEnsUpdates(client.GetNativeClient(), 1000)
if err != nil {
utils.LogError(err, "error importing ens updates", 0, nil)
continue
Expand Down
2 changes: 1 addition & 1 deletion cmd/misc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ func indexOldEth1Blocks(startBlock uint64, endBlock uint64, batchSize uint64, co
}

if importENSChanges {
if err := bt.ImportEnsUpdates(client.GetNativeClient()); err != nil {
if err := bt.ImportEnsUpdates(client.GetNativeClient(), math.MaxInt64); err != nil {
utils.LogError(err, "error importing ens from events", 0)
return
}
Expand Down
4 changes: 2 additions & 2 deletions db/ens.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ type EnsCheckedDictionary struct {
name map[string]bool
}

func (bigtable *Bigtable) ImportEnsUpdates(client *ethclient.Client) error {
func (bigtable *Bigtable) ImportEnsUpdates(client *ethclient.Client, readBatchSize int64) error {
key := fmt.Sprintf("%s:ENS:V", bigtable.chainId)

ctx, done := context.WithTimeout(context.Background(), time.Second*30)
Expand All @@ -335,7 +335,7 @@ func (bigtable *Bigtable) ImportEnsUpdates(client *ethclient.Client) error {
row_ := row[DEFAULT_FAMILY][0]
keys = append(keys, row_.Row)
return true
}, gcp_bigtable.LimitRows(1000)) // limit to max 1000 entries to avoid blocking the import of new blocks
}, gcp_bigtable.LimitRows(readBatchSize)) // limit to max 1000 entries to avoid blocking the import of new blocks
if err != nil {
return err
}
Expand Down

0 comments on commit 1e301d8

Please sign in to comment.