Ejemplo n.º 1
0
//doNode returns one of nodelist. if nodelist.len=0 returns one of initNode.
func doNode(w http.ResponseWriter, r *http.Request) {
	if manager.ListLen() > 0 {
		fmt.Fprintln(w, manager.GetNodestrSliceInList()[0])
	} else {
		fmt.Fprintln(w, cfg.InitNode.GetData()[0])
	}
}
Ejemplo n.º 2
0
//doSync checks nodes in the nodelist are alive, reloads cachelist, removes old removed files,
//reloads all tags from cachelist,reload srecent list from nodes in search list,
//and reloads cache info from files in the disk.
func doSync(fullRecent bool) {
	if manager.ListLen() == 0 {
		return
	}
	log.Println("recentList.getall start")
	recentlist.Getall(fullRecent)
	recentlist.RemoveOlds()
	log.Println("recentList.getall finished")

	if cfg.HeavyMoon && !running {
		log.Println("running heavymoon...")
		thread.CreateAllCachedirs()
		running = true
		go func() {
			log.Println("cacheList.getall start")
			download.Getall()
			log.Println("cacheList.getall finished")
			running = false
			log.Println("heavymoon end")
		}()
	}
}