mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
add flag to delay between domains (#101)
* New flag: -delay=x where x is ms to delay between domains. This feature will probably be removed some day when a better rate-limiting solution can be engineered.
This commit is contained in:
4
main.go
4
main.go
@ -37,6 +37,8 @@ var domains = flag.String("domains", "", "Comma seperated list of domain names t
|
|||||||
|
|
||||||
var interactive = flag.Bool("i", false, "Confirm or Exclude each correction before they run")
|
var interactive = flag.Bool("i", false, "Confirm or Exclude each correction before they run")
|
||||||
|
|
||||||
|
var delay = flag.Int64("d", 0, "delay between domains to avoid rate limits (in ms)")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@ -233,6 +235,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
totalCorrections += len(corrections)
|
totalCorrections += len(corrections)
|
||||||
anyErrors = printOrRunCorrections(corrections, command) || anyErrors
|
anyErrors = printOrRunCorrections(corrections, command) || anyErrors
|
||||||
|
|
||||||
|
time.Sleep(time.Duration(*delay) * time.Millisecond)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
log.Fatalf("Unknown command %s", command)
|
log.Fatalf("Unknown command %s", command)
|
||||||
|
Reference in New Issue
Block a user