Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Oct 21, 2024
1 parent b556318 commit 2a1aee2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (c *RaftCluster) Start(s Server) error {
if err != nil {
return err
}
c.checkTSOService()
c.checkTSOService(true)
cluster, err := c.LoadClusterInfo()
if err != nil {
return err
Expand Down Expand Up @@ -401,11 +401,12 @@ func (c *RaftCluster) checkSchedulingService() {
}

// checkTSOService checks the TSO service.
func (c *RaftCluster) checkTSOService() {
func (c *RaftCluster) checkTSOService(skipCheckLeader bool) {
if c.isAPIServiceMode {
return
}
if c.member.IsLeader() {
// If skipCheckLeader is true, checkTSOService is called in champaign leader process which is no need to check the leader.
if skipCheckLeader || (!skipCheckLeader && c.member.IsLeader()) {
if err := c.startTSOJobs(); err != nil {
// If there is an error, need to wait for the next check.
log.Error("failed to start TSO jobs", errs.ZapError(err))
Expand Down Expand Up @@ -451,7 +452,7 @@ func (c *RaftCluster) runServiceCheckJob() {
case <-schedulingTicker.C:
c.checkSchedulingService()
case <-tsoTicker.C:
c.checkTSOService()
c.checkTSOService(false)
}
}
}
Expand Down

0 comments on commit 2a1aee2

Please sign in to comment.