Skip to content

Commit f5463ac

Browse files
author
Peter Pratscher
committed
Make the startup lookback configurable
1 parent b976488 commit f5463ac

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

cmd/indexer/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func main() {
4040
dbName := flag.String("dbName", "", "Database name")
4141

4242
codaEndpoint := flag.String("coda", "localhost:3085/graphql", "CODA node graphql endpoint")
43+
startupLookback := flag.Int("startupLookback", 1000, "Check the last x blocks immediately after startup")
4344

4445
flag.Parse()
4546

@@ -65,7 +66,7 @@ func main() {
6566
db.DB = dbConn
6667
defer db.DB.Close()
6768

68-
indexer.Start(*codaEndpoint)
69+
indexer.Start(*codaEndpoint, *startupLookback)
6970

7071
util.WaitForCtrlC()
7172

indexer/indexer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
var logger = logrus.New().WithField("module", "indexer")
3030

3131
// Start starts the indexing process
32-
func Start(rpcEndpoint string) {
32+
func Start(rpcEndpoint string, startupLookback int) {
3333
client := rpc.NewCodaClient(rpcEndpoint)
3434

3535
newBlockChan := make(chan string)
@@ -42,7 +42,7 @@ func Start(rpcEndpoint string) {
4242

4343
go updateStatistics(time.Hour)
4444

45-
checkBlocks(client, 1000)
45+
checkBlocks(client, startupLookback)
4646
}
4747

4848
func updateStatistics(intv time.Duration) {

templates/block.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="mb-3">
99
<div class="d-md-flex py-2 justify-content-md-between">
1010
<h1 class="h4 mb-1 mb-md-0">
11-
<span class="ml-1 mr-1"><i class="fas fa-cube mr-2"></i>Block at Slot {{.Slot}}</span>
11+
<span class="ml-1 mr-1"><i class="fas fa-cube mr-2"></i>Block at Slot {{.Slot}} of Epoch {{.Epoch}}</span>
1212
</h1>
1313
<nav aria-label="breadcrumb">
1414
<ol class="breadcrumb font-size-1 mb-0" style="padding:0; background-color:transparent;">

0 commit comments

Comments
 (0)