From 3668c43a2a3fd43f0b9d56dd13551fdbcfb61bcb Mon Sep 17 00:00:00 2001 From: Dhruv Dhruv Date: Thu, 24 Oct 2024 12:49:36 +0000 Subject: [PATCH] fix: [CDE-416]: Increasing timeout to 10m for all gitspace events. (#2861) * fix: [CDE-416]: Increasing timeout to 10m for all gitspace events. --- app/services/gitspaceevent/service.go | 3 ++- app/services/gitspaceinfraevent/service.go | 2 +- cli/operations/server/config.go | 1 + types/config.go | 5 +++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/services/gitspaceevent/service.go b/app/services/gitspaceevent/service.go index eb630f703..2770ba448 100644 --- a/app/services/gitspaceevent/service.go +++ b/app/services/gitspaceevent/service.go @@ -32,6 +32,7 @@ type Config struct { EventReaderName string Concurrency int MaxRetries int + TimeoutInMins int } func (c *Config) Sanitize() error { @@ -71,7 +72,7 @@ func NewService( _, err := gitspaceEventReaderFactory.Launch(ctx, groupGitspaceEvents, config.EventReaderName, func(r *gitspaceevents.Reader) error { - const idleTimeout = 1 * time.Minute + var idleTimeout = time.Duration(config.TimeoutInMins) * time.Minute r.Configure( stream.WithConcurrency(config.Concurrency), stream.WithHandlerOptions( diff --git a/app/services/gitspaceinfraevent/service.go b/app/services/gitspaceinfraevent/service.go index f859bc6ad..d47bcf968 100644 --- a/app/services/gitspaceinfraevent/service.go +++ b/app/services/gitspaceinfraevent/service.go @@ -57,7 +57,7 @@ func NewService( _, err := gitspaceInfraEventReaderFactory.Launch(ctx, groupGitspaceInfraEvents, config.EventReaderName, func(r *gitspaceinfraevents.Reader) error { - const idleTimeout = 1 * time.Minute + var idleTimeout = time.Duration(config.TimeoutInMins) * time.Minute r.Configure( stream.WithConcurrency(config.Concurrency), stream.WithHandlerOptions( diff --git a/cli/operations/server/config.go b/cli/operations/server/config.go index 9dc041d82..70aafb395 100644 --- a/cli/operations/server/config.go +++ b/cli/operations/server/config.go @@ -463,5 +463,6 @@ func ProvideGitspaceEventConfig(config *types.Config) *gitspaceevent.Config { EventReaderName: config.InstanceID, Concurrency: config.Gitspace.Events.Concurrency, MaxRetries: config.Gitspace.Events.MaxRetries, + TimeoutInMins: config.Gitspace.Events.TimeoutInMins, } } diff --git a/types/config.go b/types/config.go index 975265549..c8332750e 100644 --- a/types/config.go +++ b/types/config.go @@ -424,8 +424,9 @@ type Config struct { AgentPort int `envconfig:"GITNESS_GITSPACE_AGENT_PORT" default:"8083"` Events struct { - Concurrency int `envconfig:"GITNESS_GITSPACE_EVENTS_CONCURRENCY" default:"4"` - MaxRetries int `envconfig:"GITNESS_GITSPACE_EVENTS_MAX_RETRIES" default:"3"` + Concurrency int `envconfig:"GITNESS_GITSPACE_EVENTS_CONCURRENCY" default:"4"` + MaxRetries int `envconfig:"GITNESS_GITSPACE_EVENTS_MAX_RETRIES" default:"3"` + TimeoutInMins int `envconfig:"GITNESS_GITSPACE_EVENTS_TIMEOUT_IN_MINS" default:"10"` } }