Skip to content

Commit

Permalink
fix the test
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Nov 21, 2023
1 parent 09360e5 commit cabf1b8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ func (c *RaftCluster) runMetricsCollectionJob() {
ticker := time.NewTicker(metricsCollectionJobInterval)
failpoint.Inject("highFrequencyClusterJobs", func() {
ticker.Stop()
ticker = time.NewTicker(time.Microsecond)
ticker = time.NewTicker(time.Millisecond)
})
defer ticker.Stop()

Expand Down Expand Up @@ -734,10 +734,10 @@ func (c *RaftCluster) Stop() {
return
}
c.running = false
c.cancel()
if !c.IsServiceIndependent(mcsutils.SchedulingServiceName) {
c.stopSchedulingJobs()
}
c.cancel()
c.Unlock()

c.wg.Wait()
Expand Down
7 changes: 1 addition & 6 deletions server/cluster/scheduling_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ func (sc *schedulingController) initCoordinatorLocked(ctx context.Context, clust
func (sc *schedulingController) runCoordinator() {
defer logutil.LogPanic()
defer sc.wg.Done()
select {
case <-sc.ctx.Done():
return
default:
}
sc.coordinator.RunUntilStop()
}

Expand Down Expand Up @@ -154,7 +149,7 @@ func (sc *schedulingController) runSchedulingMetricsCollectionJob() {
ticker := time.NewTicker(metricsCollectionJobInterval)
failpoint.Inject("highFrequencyClusterJobs", func() {
ticker.Stop()
ticker = time.NewTicker(time.Microsecond)
ticker = time.NewTicker(time.Millisecond)
})
defer ticker.Stop()

Expand Down
2 changes: 0 additions & 2 deletions tests/server/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,6 @@ func TestRaftClusterMultipleRestart(t *testing.T) {
err = rc.Start(leaderServer.GetServer())
re.NoError(err)
time.Sleep(time.Millisecond)
rc = leaderServer.GetRaftCluster()
re.NotNil(rc)
rc.Stop()
}
re.NoError(failpoint.Disable("github.com/tikv/pd/server/cluster/highFrequencyClusterJobs"))
Expand Down

0 comments on commit cabf1b8

Please sign in to comment.