Skip to content

Commit

Permalink
domain: fix data race in the ttlJobManager
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Feb 10, 2023
1 parent 1cc05a1 commit b6d96fd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,10 +903,12 @@ func (do *Domain) Close() {
do.info.RemoveMinStartTS()
}
ttlJobManager := do.ttlJobManager.Load()
ttlJobManager.Stop()
err := ttlJobManager.WaitStopped(context.Background(), 30*time.Second)
if err != nil {
logutil.BgLogger().Warn("fail to wait until the ttl job manager stop", zap.Error(err))
if ttlJobManager != nil {
ttlJobManager.Stop()
err := ttlJobManager.WaitStopped(context.Background(), 30*time.Second)
if err != nil {
logutil.BgLogger().Warn("fail to wait until the ttl job manager stop", zap.Error(err))
}
}
close(do.exit)
if do.etcdClient != nil {
Expand Down

0 comments on commit b6d96fd

Please sign in to comment.