func (p *manager) loop() {
	// main
	go func() {
		tick := time.NewTicker(1 * time.Second)
		defer tick.Stop()
		for {
			select {
			case <-p.ctx.Done():
				return
			case <-p.cache.C:
				if err := p.AddRules(); err != nil {
					log.Printf("manager.SyncRules err %s", err)
				}
			case <-tick.C:
				if err := p.schedule(); err != nil {
					log.Printf("manager.schedule err %s", err)
				}
			}
		}
	}()
}
// loop schedule collect job and send the metric to transfer
loop schedule collect job and send the metric to transfer
// loop schedule collect job and send the metric to transfer
func (p *manager) loop() {
	go func() {
		tick := time.NewTicker(1 * time.Second)
		defer tick.Stop()
		for {
			select {
			case <-p.ctx.Done():
				return
			case <-p.cache.C:
				if err := p.AddRules(); err != nil {
					log.Printf("manager.SyncRules err %s", err)
				}
			case <-tick.C:
				if err := p.schedule(); err != nil {
					log.Printf("manager.schedule err %s", err)
				}
			}
		}
	}()
}
func ( p * manager ) loop ( ) { go func ( ) { tick := time . NewTicker ( 1 * time . Second ) defer tick . Stop ( ) for { select { case <- p . ctx . Done ( ) : return case <- p . cache . C : if err := p . AddRules ( ) ; err != nil { log . Printf ( " " , err ) } case <- tick . C : if err := p . schedule ( ) ; err != nil { log . Printf ( " " , err ) } } } } ( ) }
loop schedule collect job and send the metric to transfer
loop schedule collect job and send the metric to transfer
// main