feat: Add skipping domain if checked recently

This commit is contained in:
ptrcnull 2021-10-08 15:52:12 +02:00
parent 321b77b9ac
commit 4e0038506d

19
main.go
View file

@ -25,6 +25,11 @@ func main() {
}, },
} }
recent := make([]string, 20)
for i := range recent {
recent[i] = ""
}
stream, errStream := certstream.CertStreamEventStream(false) stream, errStream := certstream.CertStreamEventStream(false)
for { for {
select { select {
@ -64,10 +69,24 @@ func main() {
if domain[0] == '*' || domain == "sni.cloudflaressl.com" { if domain[0] == '*' || domain == "sni.cloudflaressl.com" {
continue continue
} }
// skip if was checked recently
skip := false
for _, recentDomain := range recent {
if domain == recentDomain {
skip = true
}
}
if skip {
continue
}
log.Println("checking " + domain) log.Println("checking " + domain)
go c.CheckGit(domain) go c.CheckGit(domain)
go c.CheckEnv(domain) go c.CheckEnv(domain)
go c.CheckIndex(domain) go c.CheckIndex(domain)
recent = append(recent[1:], domain)
} }
case err := <-errStream: case err := <-errStream: