* update transformer to able to recheck headers (#4)
* update transformer to able to recheck headers * put cap on rechecking header * integration test for recheck headers * use enum for recheck headers param; make recheck cap configurable * update integration tests with new test config * update omni pkg with new recheck header column type * update migration with new migration tool and final tweaks needed to accommodate changes in omni pkg
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/libraries/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
// backfillMakerLogsCmd represents the backfillMakerLogs command
|
||||
@@ -50,7 +51,7 @@ func backfillMakerLogs() {
|
||||
watcher := shared.NewEventWatcher(db, blockChain)
|
||||
|
||||
watcher.AddTransformers(transformers.TransformerInitializers())
|
||||
err = watcher.Execute()
|
||||
err = watcher.Execute(constants.HeaderMissing)
|
||||
if err != nil {
|
||||
// TODO Handle watcher error in backfillMakerLogs
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ This command expects a light sync to have been run, and the presence of header r
|
||||
}
|
||||
|
||||
var transformerNames []string
|
||||
var recheckHeadersArg bool
|
||||
|
||||
func syncMakerLogs() {
|
||||
ticker := time.NewTicker(pollingInterval)
|
||||
@@ -66,7 +67,11 @@ func syncMakerLogs() {
|
||||
watcher.AddTransformers(initializers)
|
||||
|
||||
for range ticker.C {
|
||||
err = watcher.Execute()
|
||||
if recheckHeadersArg {
|
||||
err = watcher.Execute(constants.HeaderRecheck)
|
||||
} else {
|
||||
err = watcher.Execute(constants.HeaderMissing)
|
||||
}
|
||||
if err != nil {
|
||||
// TODO Handle watcher errors in ContinuousLogSync
|
||||
}
|
||||
@@ -125,4 +130,5 @@ func buildTransformerInitializerMap() map[string]shared2.TransformerInitializer
|
||||
func init() {
|
||||
rootCmd.AddCommand(continuousLogSyncCmd)
|
||||
continuousLogSyncCmd.Flags().StringSliceVar(&transformerNames, "transformers", []string{"all"}, "transformer names to be run during this command")
|
||||
continuousLogSyncCmd.Flags().BoolVar(&recheckHeadersArg, "recheckHeaders", false, "checks headers that are already checked for each transformer.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user