Skip to content

Commit

Permalink
set the zebedee client timeout to default to 30 seconds and make it c…
Browse files Browse the repository at this point in the history
…onfigurable
  • Loading branch information
cookel2 committed Mar 10, 2022
1 parent 5501a24 commit 54258c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ type Config struct {
HealthCheckCriticalTimeout time.Duration `envconfig:"HEALTHCHECK_CRITICAL_TIMEOUT"`
HealthCheckInterval time.Duration `envconfig:"HEALTHCHECK_INTERVAL"`
KafkaConfig KafkaConfig
ZebedeeURL string `envconfig:"ZEBEDEE_URL"`
ZebedeeClientTimeout time.Duration `envconfig:"ZEBEDEE_CLIENT_TIMEOUT"`
ZebedeeURL string `envconfig:"ZEBEDEE_URL"`
}

// KafkaConfig contains the config required to connect to Kafka
Expand Down Expand Up @@ -64,7 +65,8 @@ func Get() (*Config, error) {
SecSkipVerify: false,
Version: "1.0.2",
},
ZebedeeURL: "http://localhost:8082",
ZebedeeClientTimeout: 30 * time.Second,
ZebedeeURL: "http://localhost:8082",
}

return cfg, envconfig.Process("", cfg)
Expand Down
1 change: 1 addition & 0 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func Run(ctx context.Context, serviceList *ExternalServiceList, buildTime, gitCo
}

httpClient := dpHTTP.NewClient()
httpClient.SetTimeout(cfg.ZebedeeClientTimeout) // Published Index takes about 10s to return so add a bit more
zebedeeClient := newZebedeeClient(httpClient, cfg)

// Event Handler for Kafka Consumer
Expand Down

0 comments on commit 54258c7

Please sign in to comment.