Skip to content

Commit

Permalink
kafka_consumer:fix wrong timezone when 'TZ' env is not set and downst…
Browse files Browse the repository at this point in the history
…ream is mysql (#1084)
  • Loading branch information
dengqee authored Nov 19, 2020
1 parent 53886d2 commit 9ff9a78
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions kafka_consumer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,9 @@ type Consumer struct {
// NewConsumer creates a new cdc kafka consumer
func NewConsumer(ctx context.Context) (*Consumer, error) {
// TODO support filter in downstream sink
tz := time.Local
if strings.ToLower(timezone) != "system" {
var err error
tz, err = time.LoadLocation(timezone)
if err != nil {
return nil, errors.Annotate(err, "can not load timezone")
}
tz, err := util.GetTimezone(timezone)
if err != nil {
return nil, errors.Annotate(err, "can not load timezone")
}
ctx = util.PutTimezoneInCtx(ctx, tz)
filter, err := cdcfilter.NewFilter(config.GetDefaultReplicaConfig())
Expand Down

0 comments on commit 9ff9a78

Please sign in to comment.