func (w *GCWorker) leaderTick() error {
	if w.gcIsRunning {
		return nil
	}
	// When the worker is just started, or an old GC job has just finished,
	// wait a while before starting a new job.
	if time.Since(w.lastFinish) < gcWaitTime {
		return nil
	}

	ok, safePoint, err := w.prepare()
	if err != nil || !ok {
		return errors.Trace(err)
	}

	w.gcIsRunning = true
	log.Infof("[gc worker] %s starts GC job, safePoint: %v", w.uuid, safePoint)
	go w.runGCJob(safePoint)
	return nil
}
// Leader of GC worker checks if it should start a GC job every tick.
Leader of GC worker checks if it should start a GC job every tick.
// Leader of GC worker checks if it should start a GC job every tick .
func (w *GCWorker) leaderTick() error {
	if w.gcIsRunning {
		return nil
	}
	if time.Since(w.lastFinish) < gcWaitTime {
		return nil
	}
	ok, safePoint, err := w.prepare()
	if err != nil || !ok {
		return errors.Trace(err)
	}
	w.gcIsRunning = true
	log.Infof("[gc worker] %s starts GC job, safePoint: %v", w.uuid, safePoint)
	go w.runGCJob(safePoint)
	return nil
}
func ( w * GCWorker ) leaderTick ( ) error { if w . gcIsRunning { return nil } if time . Since ( w . lastFinish ) < gcWaitTime { return nil } ok , safePoint , err := w . prepare ( ) if err != nil || ! ok { return errors . Trace ( err ) } w . gcIsRunning = true log . Infof ( " " , w . uuid , safePoint ) go w . runGCJob ( safePoint ) return nil }
Leader of GC worker checks if it should start a GC job every tick.
Leader of GC worker checks if it should start a GC job every tick .
// When the worker is just started, or an old GC job has just finished, // wait a while before starting a new job.