Close remaining DB connections
This commit is contained in:
parent
a1473dfb58
commit
3b21f4db37
@ -291,6 +291,8 @@ func (this *Applier) WriteChangelogState(value string) (string, error) {
|
||||
}
|
||||
|
||||
func (this *Applier) FinalCleanup() {
|
||||
this.db.Close()
|
||||
this.singletonDB.Close()
|
||||
this.finishedMigrating = true
|
||||
}
|
||||
|
||||
|
@ -1224,6 +1224,7 @@ func (this *Migrator) finalCleanup() error {
|
||||
|
||||
this.finishedMigrating = true
|
||||
this.applier.FinalCleanup()
|
||||
this.eventsStreamer.FinalCleanup()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -192,7 +192,14 @@ func (this *EventsStreamer) StreamEvents(canStopStreaming func() bool) error {
|
||||
var successiveFailures int64
|
||||
var lastAppliedRowsEventHint mysql.BinlogCoordinates
|
||||
for {
|
||||
if canStopStreaming() {
|
||||
return nil
|
||||
}
|
||||
if err := this.binlogReader.StreamEvents(canStopStreaming, this.eventsChannel); err != nil {
|
||||
if canStopStreaming() {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Infof("StreamEvents encountered unexpected error: %+v", err)
|
||||
this.migrationContext.MarkPointOfInterest()
|
||||
time.Sleep(ReconnectStreamerSleepSeconds * time.Second)
|
||||
@ -223,3 +230,8 @@ func (this *EventsStreamer) Close() (err error) {
|
||||
log.Infof("Closed streamer connection. err=%+v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
func (this *EventsStreamer) FinalCleanup() {
|
||||
this.db.Close()
|
||||
return
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ func GetReplicationLag(connectionConfig *ConnectionConfig) (replicationLag time.
|
||||
replicationLag = time.Duration(secondsBehindMaster.Int64) * time.Second
|
||||
return nil
|
||||
})
|
||||
|
||||
db.Close()
|
||||
return replicationLag, err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user