Skip to content

Commit

Permalink
Fix nil pointer in UpdateLoggerWithServiceName (cadence-workflow#1726)
Browse files Browse the repository at this point in the history
  • Loading branch information
vancexu authored Apr 22, 2019
1 parent e514d1e commit e3ba38c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion service/frontend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ type Service struct {

// NewService builds a new cadence-frontend service
func NewService(params *service.BootstrapParams) common.Daemon {
params.UpdateLoggerWithServiceName(common.FrontendServiceName)
config := NewConfig(dynamicconfig.NewCollection(params.DynamicConfig, params.Logger), params.PersistenceConfig.NumHistoryShards, params.ESConfig.Enable, true)
params.ThrottledLogger = loggerimpl.NewThrottledLogger(params.Logger, config.ThrottledLogRPS)
params.UpdateLoggerWithServiceName(common.FrontendServiceName)
return &Service{
params: params,
config: config,
Expand Down
4 changes: 2 additions & 2 deletions service/history/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
package history

import (
"github.com/uber/cadence/common/log/loggerimpl"
"time"

"github.com/uber/cadence/common"
"github.com/uber/cadence/common/log/loggerimpl"
"github.com/uber/cadence/common/log/tag"
"github.com/uber/cadence/common/metrics"
persistencefactory "github.com/uber/cadence/common/persistence/persistence-factory"
Expand Down Expand Up @@ -244,12 +244,12 @@ type Service struct {

// NewService builds a new cadence-history service
func NewService(params *service.BootstrapParams) common.Daemon {
params.UpdateLoggerWithServiceName(common.HistoryServiceName)
config := NewConfig(dynamicconfig.NewCollection(params.DynamicConfig, params.Logger),
params.PersistenceConfig.NumHistoryShards,
params.ESConfig.Enable,
params.PersistenceConfig.DefaultStoreType())
params.ThrottledLogger = loggerimpl.NewThrottledLogger(params.Logger, config.ThrottledLogRPS)
params.UpdateLoggerWithServiceName(common.HistoryServiceName)
return &Service{
params: params,
stopC: make(chan struct{}),
Expand Down
2 changes: 1 addition & 1 deletion service/matching/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ type Service struct {

// NewService builds a new cadence-matching service
func NewService(params *service.BootstrapParams) common.Daemon {
params.UpdateLoggerWithServiceName(common.MatchingServiceName)
config := NewConfig(dynamicconfig.NewCollection(params.DynamicConfig, params.Logger))
params.ThrottledLogger = loggerimpl.NewThrottledLogger(params.Logger, config.ThrottledLogRPS)
params.UpdateLoggerWithServiceName(common.MatchingServiceName)
return &Service{
params: params,
config: config,
Expand Down
2 changes: 1 addition & 1 deletion service/worker/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ type (

// NewService builds a new cadence-worker service
func NewService(params *service.BootstrapParams) common.Daemon {
params.UpdateLoggerWithServiceName(common.WorkerServiceName)
config := NewConfig(params)
params.ThrottledLogger = loggerimpl.NewThrottledLogger(params.Logger, config.ThrottledLogRPS)
params.UpdateLoggerWithServiceName(common.WorkerServiceName)
return &Service{
params: params,
config: config,
Expand Down

0 comments on commit e3ba38c

Please sign in to comment.