Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anodar committed May 23, 2024
1 parent ec0e295 commit f48c256
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions validator/valnode/redis/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ func (s *ValidationServer) Start(ctx_in context.Context) {
readyStreams <- struct{}{}
return
}
time.Sleep(time.Millisecond * 100)
select {
case <-ctx.Done():
log.Info("Context done", "error", ctx.Err().Error())
return
case <-time.After(time.Millisecond * 100):
}
}
})
s.StopWaiter.LaunchThread(func(ctx context.Context) {
select {
case <-ctx.Done():
log.Error("Context done", "error", ctx.Err().Error())
log.Info("Context done", "error", ctx.Err().Error())
return
case <-ready: // Wait until the stream exists and start consuming iteratively.
}
Expand Down Expand Up @@ -111,7 +116,7 @@ func (s *ValidationServer) Start(ctx_in context.Context) {
case <-time.After(s.streamTimeout):
log.Error("Waiting for redis streams timed out")
case <-ctx_in.Done():
log.Error(("Context expired, failed to start"))
log.Info(("Context expired, failed to start"))
return
}
}
Expand All @@ -130,17 +135,20 @@ var DefaultValidationServerConfig = ValidationServerConfig{
RedisURL: "",
ConsumerConfig: pubsub.DefaultConsumerConfig,
ModuleRoots: []string{},
StreamTimeout: 10 * time.Minute,
}

var TestValidationServerConfig = ValidationServerConfig{
RedisURL: "",
ConsumerConfig: pubsub.TestConsumerConfig,
ModuleRoots: []string{},
StreamTimeout: time.Minute,
}

func ValidationServerConfigAddOptions(prefix string, f *pflag.FlagSet) {

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Go Tests (long)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Go Tests (defaults)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Go Tests (stylus)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"

Check failure on line 148 in validator/valnode/redis/consumer.go

View workflow job for this annotation

GitHub Actions / Go Tests (race)

koanf tag name: "tream-timeout" doesn't match the field: "StreamTimeout"
pubsub.ConsumerConfigAddOptions(prefix+".consumer-config", f)
f.StringSlice(prefix+".module-roots", nil, "Supported module root hashes")
f.Duration(prefix+"stream-timeout", DefaultValidationServerConfig.StreamTimeout, "Timeout on polling for existence of redis streams")
}

func (cfg *ValidationServerConfig) Enabled() bool {
Expand Down

0 comments on commit f48c256

Please sign in to comment.