Пример #1
0
// Reload triggers a new state load from the configured mesos masters.
// This method is not goroutine-safe.
func (res *Resolver) Reload() {
	t := records.RecordGenerator{}
	err := t.ParseState(res.config, res.masters...)

	if err != nil {
		logging.VeryVerbose.Println("Warning: master not found; serving only static entries")
	}

	timestamp := uint32(time.Now().Unix())
	// may need to refactor for fairness
	res.rsLock.Lock()
	defer res.rsLock.Unlock()
	res.config.SOASerial = timestamp
	res.rs = &t

	logging.PrintCurLog()
}
Пример #2
0
// triggers a new refresh from mesos master
func (res *Resolver) Reload() {
	t := records.RecordGenerator{}
	// Being very conservative
	res.leaderLock.RLock()
	currentLeader := res.leader
	res.leaderLock.RUnlock()
	err := t.ParseState(currentLeader, res.config)

	if err == nil {
		timestamp := uint32(time.Now().Unix())
		// may need to refactor for fairness
		res.rsLock.Lock()
		defer res.rsLock.Unlock()
		res.config.SOASerial = timestamp
		res.rs = &t
	} else {
		logging.VeryVerbose.Println("Warning: master not found; keeping old DNS state")
	}
}