diff --git a/cmd/composeAndExecute.go b/cmd/composeAndExecute.go index 1c5ac10a..cb902d82 100644 --- a/cmd/composeAndExecute.go +++ b/cmd/composeAndExecute.go @@ -19,6 +19,7 @@ import ( "os" "plugin" syn "sync" + "time" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -191,5 +192,6 @@ func composeAndExecute() { func init() { rootCmd.AddCommand(composeAndExecuteCmd) - composeAndExecuteCmd.Flags().BoolVar(&recheckHeadersArg, "recheckHeaders", false, "checks headers that are already checked for each transformer.") + composeAndExecuteCmd.Flags().BoolVarP(&recheckHeadersArg, "recheck-headers", "r", false, "whether to re-check headers for watched events") + composeAndExecuteCmd.Flags().DurationVarP(&queueRecheckInterval, "queue-recheck-interval", "q", 5 * time.Minute, "how often to recheck queued storage diffs") } diff --git a/cmd/execute.go b/cmd/execute.go index f3eea0f3..ecccdee0 100644 --- a/cmd/execute.go +++ b/cmd/execute.go @@ -138,7 +138,8 @@ func execute() { func init() { rootCmd.AddCommand(executeCmd) - executeCmd.Flags().BoolVar(&recheckHeadersArg, "recheckHeaders", false, "checks headers that are already checked for each transformer.") + executeCmd.Flags().BoolVarP(&recheckHeadersArg, "recheck-headers", "r", false, "whether to re-check headers for watched events") + executeCmd.Flags().DurationVarP(&queueRecheckInterval, "queue-recheck-interval", "q", 5 * time.Minute, "how often to recheck queued storage diffs") } type Exporter interface { diff --git a/cmd/root.go b/cmd/root.go index 7eee8793..dba91864 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -41,6 +41,7 @@ var ( genConfig config.Plugin ipc string levelDbPath string + queueRecheckInterval time.Duration startingBlockNumber int64 storageDiffsPath string syncAll bool @@ -50,7 +51,6 @@ var ( const ( pollingInterval = 7 * time.Second - queueRecheckInterval = 5 * time.Minute validationWindow = 15 ) diff --git a/documentation/composeAndExecute.md b/documentation/composeAndExecute.md index 1a0dac6b..8ea1abc9 100644 --- a/documentation/composeAndExecute.md +++ b/documentation/composeAndExecute.md @@ -36,6 +36,20 @@ composeAndExecute: `./vulcanizedb composeAndExecute --config=./environments/config_name.toml` +## Flags + +The `compose` and `composeAndExecute` commands can be passed optional flags to specify the operation of the watchers: + +- `--recheck-headers`/`-r` - specifies whether to re-check headers for events after the header has already been queried for watched logs. +Can be useful for redundancy if you suspect that your node is not always returning all desired logs on every query. +Argument is expected to be a boolean: e.g. `-r=true`. +Defaults to `false`. + +- `query-recheck-interval`/`-q` - specifies interval for re-checking storage diffs that haven been queued for later processing +(by default, the storage watched queues storage diffs if transformer execution fails, on the assumption that subsequent data derived from the event transformers may enable us to decode storage keys that we don't recognize right now). +Argument is expected to be a duration (integer measured in nanoseconds): e.g. `-q=10m30s` (for 10 minute, 30 second intervals). +Defaults to `5m` (5 minutes). + ## Configuration A .toml config file is specified when executing the commands. The config provides information for composing a set of transformers from external repositories: