From 218f51576c7e1fc4618348555b68a321cb4d073d Mon Sep 17 00:00:00 2001 From: lance6716 Date: Thu, 9 Sep 2021 16:28:38 +0800 Subject: [PATCH] make fmt and address comment --- syncer/status_test.go | 10 ++++++---- syncer/syncer.go | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/syncer/status_test.go b/syncer/status_test.go index 8691ae3c74..fa0ed4fa65 100644 --- a/syncer/status_test.go +++ b/syncer/status_test.go @@ -19,7 +19,7 @@ var _ = Suite(&statusSuite{}) type statusSuite struct{} -func (t *statusSuite) TestStatueRace(c *C) { +func (t *statusSuite) TestStatusRace(c *C) { s := &Syncer{} l := log.With(zap.String("unit test", "TestStatueRace")) @@ -32,7 +32,7 @@ func (t *statusSuite) TestStatueRace(c *C) { Location: binlog.Location{ Position: mysql.Position{ Name: "mysql-bin.000123", - Pos: 223, + Pos: 223, }, }, Binlogs: binlog.FileSizes(nil), @@ -42,12 +42,14 @@ func (t *statusSuite) TestStatueRace(c *C) { for i := 0; i < 10; i++ { wg.Add(1) go func() { + defer wg.Done() ret := s.Status(sourceStatus) status := ret.(*pb.SyncStatus) c.Assert(status.MasterBinlog, Equals, "(mysql-bin.000123, 223)") c.Assert(status.SyncerBinlog, Equals, "(mysql-bin.000123, 123)") }() } + wg.Wait() } type mockCheckpoint struct { @@ -58,7 +60,7 @@ func (*mockCheckpoint) FlushedGlobalPoint() binlog.Location { return binlog.Location{ Position: mysql.Position{ Name: "mysql-bin.000123", - Pos: 123, + Pos: 123, }, } -} \ No newline at end of file +} diff --git a/syncer/syncer.go b/syncer/syncer.go index 678015aa8f..0f51c79f3e 100644 --- a/syncer/syncer.go +++ b/syncer/syncer.go @@ -162,7 +162,7 @@ type Syncer struct { closed atomic.Bool - start atomic.Time + start atomic.Time lastTime atomic.Time // safeMode is used to track if we need to generate dml with safe-mode