-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbackfill.go
More file actions
34 lines (28 loc) · 828 Bytes
/
backfill.go
File metadata and controls
34 lines (28 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cmd
import (
"fmt"
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/thirdweb-dev/indexer/internal/backfill"
)
var backfillCmd = &cobra.Command{
Use: "backfill",
Short: "run backfill",
Long: "backfill data from old clickhouse + rpc to s3. if cannot get all blocks for a range, it will panic",
Run: RunBackfill,
}
func RunBackfill(cmd *cobra.Command, args []string) {
fmt.Println("running backfill")
// Start Prometheus metrics server
log.Info().Msg("Starting Metrics Server on port 2112")
go func() {
http.Handle("/metrics", promhttp.Handler())
if err := http.ListenAndServe(":2112", nil); err != nil {
log.Error().Err(err).Msg("Metrics server error")
}
}()
backfill.Init()
backfill.RunBackfill()
}