Skip to content

Commit

Permalink
fixup! chore: use the new reloadable config api in reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
atzoum committed Sep 25, 2023
1 parent 2ccaf2c commit fe3c70b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions enterprise/reporting/error_reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type ErrorDetailReporter struct {
sleepInterval misc.ValueLoader[time.Duration]
mainLoopSleepInterval misc.ValueLoader[time.Duration]
maxConcurrentRequests misc.ValueLoader[int]
maxOpenConnections misc.ValueLoader[int]
maxOpenConnections int
workspaceIDForSourceIDMap map[string]string
destinationIDMap map[string]destDetail
srcWspMutex sync.RWMutex
Expand Down Expand Up @@ -99,7 +99,7 @@ func NewEdReporterFromEnvConfig() *ErrorDetailReporter {
mainLoopSleepInterval := config.GetReloadableDurationVar(5, time.Second, "Reporting.mainLoopSleepInterval")
sleepInterval := config.GetReloadableDurationVar(30, time.Second, "Reporting.sleepInterval")
maxConcurrentRequests := config.GetReloadableIntVar(32, 1, "Reporting.maxConcurrentRequests")
maxOpenConnections := config.GetReloadableIntVar(16, 1, "Reporting.errorReporting.maxOpenConnections")
maxOpenConnections := config.GetIntVar(16, 1, "Reporting.errorReporting.maxOpenConnections")

log := logger.NewLogger().Child("enterprise").Child("error-detail-reporting")
extractor := NewErrorDetailExtractor(log)
Expand Down Expand Up @@ -278,7 +278,7 @@ func (edRep *ErrorDetailReporter) migrate(c types.Config) (*sql.DB, error) {
if err != nil {
return nil, err
}
dbHandle.SetMaxOpenConns(edRep.maxOpenConnections.Load())
dbHandle.SetMaxOpenConns(edRep.maxOpenConnections)

m := &migrator.Migrator{
Handle: dbHandle,
Expand Down
6 changes: 3 additions & 3 deletions enterprise/reporting/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type Handle struct {
mainLoopSleepInterval misc.ValueLoader[time.Duration]
dbQueryTimeout *config.Reloadable[time.Duration]
sourcesWithEventNameTrackingDisabled []string
maxOpenConnections misc.ValueLoader[int]
maxOpenConnections int
maxConcurrentRequests misc.ValueLoader[int]

getMinReportedAtQueryTime stats.Measurement
Expand All @@ -80,7 +80,7 @@ func NewFromEnvConfig(log logger.Logger) *Handle {
mainLoopSleepInterval := config.GetReloadableDurationVar(5, time.Second, "Reporting.mainLoopSleepInterval")
sleepInterval := config.GetReloadableDurationVar(30, time.Second, "Reporting.sleepInterval")
maxConcurrentRequests := config.GetReloadableIntVar(32, 1, "Reporting.maxConcurrentRequests")
maxOpenConnections := config.GetReloadableIntVar(32, 1, "Reporting.maxOpenConnections")
maxOpenConnections := config.GetIntVar(32, 1, "Reporting.maxOpenConnections")
dbQueryTimeout = config.GetReloadableDurationVar(60, time.Second, "Reporting.dbQueryTimeout")
// only send reports for wh actions sources if whActionsOnly is configured
whActionsOnly := config.GetBool("REPORTING_WH_ACTIONS_ONLY", false)
Expand Down Expand Up @@ -161,7 +161,7 @@ func (r *Handle) AddClient(ctx context.Context, c types.Config) {
if err != nil {
panic(err)
}
dbHandle.SetMaxOpenConns(r.maxOpenConnections.Load())
dbHandle.SetMaxOpenConns(r.maxOpenConnections)

m := &migrator.Migrator{
Handle: dbHandle,
Expand Down

0 comments on commit fe3c70b

Please sign in to comment.