mirror of
				https://github.com/taigrr/godns
				synced 2025-01-18 04:03:25 -08:00 
			
		
		
		
	bug fix for sleeping
This commit is contained in:
		
							parent
							
								
									4b69c69f34
								
							
						
					
					
						commit
						9020971add
					
				@ -57,10 +57,8 @@ func (handler *DNSPodHandler) DomainLoop(domain *godns.Domain, panicChan chan<-
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if savedIP != "" && strings.TrimRight(currentIP, "\n") == strings.TrimRight(savedIP, "\n") {
 | 
							if savedIP != "" && strings.TrimRight(currentIP, "\n") == strings.TrimRight(savedIP, "\n") {
 | 
				
			||||||
			log.Printf("Current IP is not changed, no need to update...")
 | 
								log.Printf("Current IP is not changed, no need to update...")
 | 
				
			||||||
			continue
 | 
					 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			godns.SaveCurrentIP(currentIP)
 | 
								godns.SaveCurrentIP(currentIP)
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for _, subDomain := range domain.SubDomains {
 | 
								for _, subDomain := range domain.SubDomains {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -79,8 +77,10 @@ func (handler *DNSPodHandler) DomainLoop(domain *godns.Domain, panicChan chan<-
 | 
				
			|||||||
					log.Printf("%s.%s Current IP is same as domain IP, no need to update...\n", subDomain, domain.DomainName)
 | 
										log.Printf("%s.%s Current IP is same as domain IP, no need to update...\n", subDomain, domain.DomainName)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//Interval is 5 minutes
 | 
							//Interval is 5 minutes
 | 
				
			||||||
 | 
							log.Printf("Going to sleep, will start next checking in %d minutes...\r\n", godns.INTERVAL)
 | 
				
			||||||
		time.Sleep(time.Minute * godns.INTERVAL)
 | 
							time.Sleep(time.Minute * godns.INTERVAL)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -53,17 +53,16 @@ func (handler *HEHandler) DomainLoop(domain *godns.Domain, panicChan chan<- godn
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if savedIP != "" && currentIP == savedIP {
 | 
							if savedIP != "" && currentIP == savedIP {
 | 
				
			||||||
			log.Printf("Current IP is not changed, no need to update...")
 | 
								log.Printf("Current IP is not changed, no need to update...")
 | 
				
			||||||
			continue
 | 
					 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			godns.SaveCurrentIP(currentIP)
 | 
								godns.SaveCurrentIP(currentIP)
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			for _, subDomain := range domain.SubDomains {
 | 
								for _, subDomain := range domain.SubDomains {
 | 
				
			||||||
				log.Printf("%s.%s Start to update record IP...\n", subDomain, domain.DomainName)
 | 
									log.Printf("%s.%s Start to update record IP...\n", subDomain, domain.DomainName)
 | 
				
			||||||
				handler.UpdateIP(domain.DomainName, subDomain, currentIP)
 | 
									handler.UpdateIP(domain.DomainName, subDomain, currentIP)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Interval is 5 minutes
 | 
							// Interval is 5 minutes
 | 
				
			||||||
 | 
							log.Printf("Going to sleep, will start next checking in %d minutes...\r\n", godns.INTERVAL)
 | 
				
			||||||
		time.Sleep(time.Minute * godns.INTERVAL)
 | 
							time.Sleep(time.Minute * godns.INTERVAL)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user