initialize streaming events without lazy initialization (#16016)

This commit is contained in:
Harshavardhana
2022-11-07 08:01:24 -08:00
committed by GitHub
parent 1f3db03bf0
commit 21251d8c22
10 changed files with 81 additions and 51 deletions

View File

@@ -382,9 +382,6 @@ func (target *MySQLTarget) initMySQL() error {
return errNotConnected
}
if target.store != nil {
streamEventsFromStore(target.store, target, target.quitCh, target.loggerOnce)
}
return nil
}
@@ -413,12 +410,18 @@ func NewMySQLTarget(id string, args MySQLArgs, loggerOnce logger.LogOnce) (*MySQ
args.DSN = config.FormatDSN()
}
return &MySQLTarget{
target := &MySQLTarget{
id: event.TargetID{ID: id, Name: "mysql"},
args: args,
firstPing: false,
store: store,
loggerOnce: loggerOnce,
quitCh: make(chan struct{}),
}, nil
}
if target.store != nil {
streamEventsFromStore(target.store, target, target.quitCh, target.loggerOnce)
}
return target, nil
}